{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Scatter Makers"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Circle Markers"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "from bokeh.plotting import figure, output_file, show\n",
    "\n",
    "#ouptput to static HTML file\n",
    "output_file(\"Output//4_1-circle.html\")\n",
    "\n",
    "p=figure(plot_width=400,plot_height=400)\n",
    "\n",
    "#add a circle renderer with a size, color and alpha\n",
    "p.circle(x=[1,2,3,4,5,],y=[6,7,2,4,5], size=20, color=\"navy\", alpha=0.5)\n",
    "\n",
    "#show the results\n",
    "show(p)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Circle Square"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [],
   "source": [
    "from bokeh.plotting import figure, output_file, show\n",
    "\n",
    "#ouptput to static HTML file\n",
    "output_file(\"Output//4_1-square.html\")\n",
    "\n",
    "p=figure(plot_width=400,plot_height=400)\n",
    "\n",
    "#add a circle renderer with a size, color and alpha\n",
    "p.square(x=[1,2,3,4,5,],y=[6,7,2,4,5], size=20, color=\"olive\", alpha=0.5)\n",
    "\n",
    "#show the results\n",
    "show(p)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Interactive Scatter"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [],
   "source": [
    "from bokeh.models import HoverTool\n",
    "from bokeh.plotting import figure, output_file, show\n",
    "\n",
    "#ouptput to static HTML file\n",
    "output_file(\"Output//4_1-square.html\")\n",
    "\n",
    "p=figure(plot_width=400,plot_height=400)\n",
    "\n",
    "#add a circle renderer with a size, color and alpha\n",
    "p.square(x=[1,2,3,4,5,],y=[6,7,2,4,5],size=20, color=\"olive\", alpha=0.5)\n",
    "\n",
    "#通过tooltips引用交互指针\n",
    "hover=HoverTool(tooltips=[(\"(x,y)\",\"(@x,@y)\")])\n",
    "p.add_tools(hover)\n",
    "\n",
    "#show the results\n",
    "show(p)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Line Glyphs"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Single Lines"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "import numpy as np\n",
    "from bokeh.plotting import figure, output_file, show\n",
    "\n",
    "output_file(\"Output//4_1-SimpleLine.html\")\n",
    "p=figure(plot_width=400, plot_height=400)\n",
    "\n",
    "#add a line rendered\n",
    "x=np.arange(1,6,1)          #生成1~5连续数\n",
    "y=np.random.randint(1,10,5)  #生成随机整数\n",
    "p.line(x=x,y=y,line_width=2)\n",
    "\n",
    "show(p)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Step Lines"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [],
   "source": [
    "#Step didn't existed in 0.12.7 version\n",
    "import numpy as np\n",
    "from bokeh.plotting import figure, output_file, show\n",
    "\n",
    "output_file(\"Output//4_1-Stepline.html\")\n",
    "p=figure(plot_width=400,plot_height=400)\n",
    "\n",
    "#add a steps rendered\n",
    "x=np.arange(1,6,1)          #生成1~5连续数\n",
    "y=np.random.randint(1,10,5)  #生成随机整数\n",
    "# p.step([1, 2, 3, 4, 5], [6, 7, 2, 4, 5], line_width=2, mode=\"center\")\n",
    "\n",
    "# show(p)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Multiple Lines"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [],
   "source": [
    "import numpy as np\n",
    "from bokeh.plotting import figure, output_file,show\n",
    "\n",
    "output_file(\"Output//4_1-patch.html\")\n",
    "p=figure(plot_width=600,plot_height=400)\n",
    "\n",
    "# add multiple renders\n",
    "x0=np.arange(1,6,1)          #生成连续数1~5\n",
    "x1=np.arange(1,11,1)         #生成连续数1~10\n",
    "x2=np.arange(1,20,1)         #生成连续数1~10\n",
    "\n",
    "y0=np.random.randint(1,10,5)  #生成随机整数\n",
    "y1=np.random.randint(1,15,10)  #生成随机整数\n",
    "y2=np.random.randint(1,15,19)  #生成随机整数\n",
    "\n",
    "# \"list of lists\" for x and y positions of each line\n",
    "p.multi_line([x0,x1,x2],[y0,y1,y2],\n",
    "             color=[\"firebrick\",\"navy\",\"orange\"],alpha=[0.8,0.3,0.5],line_width=[2,3,4])\n",
    "\n",
    "show(p)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Missing Points"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 38,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "\n",
       "    <div class=\"bk-root\">\n",
       "        <a href=\"https://bokeh.pydata.org\" target=\"_blank\" class=\"bk-logo bk-logo-small bk-logo-notebook\"></a>\n",
       "        <span id=\"4719d191-f3bf-430d-b5db-cd60338170a4\">Loading BokehJS ...</span>\n",
       "    </div>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "application/javascript": [
       "\n",
       "(function(root) {\n",
       "  function now() {\n",
       "    return new Date();\n",
       "  }\n",
       "\n",
       "  var force = true;\n",
       "\n",
       "  if (typeof (root._bokeh_onload_callbacks) === \"undefined\" || force === true) {\n",
       "    root._bokeh_onload_callbacks = [];\n",
       "    root._bokeh_is_loading = undefined;\n",
       "  }\n",
       "\n",
       "\n",
       "  \n",
       "  if (typeof (root._bokeh_timeout) === \"undefined\" || force === true) {\n",
       "    root._bokeh_timeout = Date.now() + 5000;\n",
       "    root._bokeh_failed_load = false;\n",
       "  }\n",
       "\n",
       "  var NB_LOAD_WARNING = {'data': {'text/html':\n",
       "     \"<div style='background-color: #fdd'>\\n\"+\n",
       "     \"<p>\\n\"+\n",
       "     \"BokehJS does not appear to have successfully loaded. If loading BokehJS from CDN, this \\n\"+\n",
       "     \"may be due to a slow or bad network connection. Possible fixes:\\n\"+\n",
       "     \"</p>\\n\"+\n",
       "     \"<ul>\\n\"+\n",
       "     \"<li>re-rerun `output_notebook()` to attempt to load from CDN again, or</li>\\n\"+\n",
       "     \"<li>use INLINE resources instead, as so:</li>\\n\"+\n",
       "     \"</ul>\\n\"+\n",
       "     \"<code>\\n\"+\n",
       "     \"from bokeh.resources import INLINE\\n\"+\n",
       "     \"output_notebook(resources=INLINE)\\n\"+\n",
       "     \"</code>\\n\"+\n",
       "     \"</div>\"}};\n",
       "\n",
       "  function display_loaded() {\n",
       "    if (root.Bokeh !== undefined) {\n",
       "      var el = document.getElementById(\"4719d191-f3bf-430d-b5db-cd60338170a4\");\n",
       "      if (el != null) {\n",
       "        el.textContent = \"BokehJS \" + Bokeh.version + \" successfully loaded.\";\n",
       "      }\n",
       "    } else if (Date.now() < root._bokeh_timeout) {\n",
       "      setTimeout(display_loaded, 100)\n",
       "    }\n",
       "  }\n",
       "\n",
       "\n",
       "  function run_callbacks() {\n",
       "    try {\n",
       "      root._bokeh_onload_callbacks.forEach(function(callback) { callback() });\n",
       "    }\n",
       "    finally {\n",
       "      delete root._bokeh_onload_callbacks\n",
       "    }\n",
       "    console.info(\"Bokeh: all callbacks have finished\");\n",
       "  }\n",
       "\n",
       "  function load_libs(js_urls, callback) {\n",
       "    root._bokeh_onload_callbacks.push(callback);\n",
       "    if (root._bokeh_is_loading > 0) {\n",
       "      console.log(\"Bokeh: BokehJS is being loaded, scheduling callback at\", now());\n",
       "      return null;\n",
       "    }\n",
       "    if (js_urls == null || js_urls.length === 0) {\n",
       "      run_callbacks();\n",
       "      return null;\n",
       "    }\n",
       "    console.log(\"Bokeh: BokehJS not loaded, scheduling load and callback at\", now());\n",
       "    root._bokeh_is_loading = js_urls.length;\n",
       "    for (var i = 0; i < js_urls.length; i++) {\n",
       "      var url = js_urls[i];\n",
       "      var s = document.createElement('script');\n",
       "      s.src = url;\n",
       "      s.async = false;\n",
       "      s.onreadystatechange = s.onload = function() {\n",
       "        root._bokeh_is_loading--;\n",
       "        if (root._bokeh_is_loading === 0) {\n",
       "          console.log(\"Bokeh: all BokehJS libraries loaded\");\n",
       "          run_callbacks()\n",
       "        }\n",
       "      };\n",
       "      s.onerror = function() {\n",
       "        console.warn(\"failed to load library \" + url);\n",
       "      };\n",
       "      console.log(\"Bokeh: injecting script tag for BokehJS library: \", url);\n",
       "      document.getElementsByTagName(\"head\")[0].appendChild(s);\n",
       "    }\n",
       "  };var element = document.getElementById(\"4719d191-f3bf-430d-b5db-cd60338170a4\");\n",
       "  if (element == null) {\n",
       "    console.log(\"Bokeh: ERROR: autoload.js configured with elementid '4719d191-f3bf-430d-b5db-cd60338170a4' but no matching script tag was found. \")\n",
       "    return false;\n",
       "  }\n",
       "\n",
       "  var js_urls = [\"https://cdn.pydata.org/bokeh/release/bokeh-0.12.7.min.js\", \"https://cdn.pydata.org/bokeh/release/bokeh-widgets-0.12.7.min.js\", \"https://cdn.pydata.org/bokeh/release/bokeh-tables-0.12.7.min.js\", \"https://cdn.pydata.org/bokeh/release/bokeh-gl-0.12.7.min.js\"];\n",
       "\n",
       "  var inline_js = [\n",
       "    function(Bokeh) {\n",
       "      Bokeh.set_log_level(\"info\");\n",
       "    },\n",
       "    \n",
       "    function(Bokeh) {\n",
       "      \n",
       "    },\n",
       "    \n",
       "    function(Bokeh) {\n",
       "      \n",
       "      document.getElementById(\"4719d191-f3bf-430d-b5db-cd60338170a4\").textContent = \"BokehJS is loading...\";\n",
       "    },\n",
       "    function(Bokeh) {\n",
       "      console.log(\"Bokeh: injecting CSS: https://cdn.pydata.org/bokeh/release/bokeh-0.12.7.min.css\");\n",
       "      Bokeh.embed.inject_css(\"https://cdn.pydata.org/bokeh/release/bokeh-0.12.7.min.css\");\n",
       "      console.log(\"Bokeh: injecting CSS: https://cdn.pydata.org/bokeh/release/bokeh-widgets-0.12.7.min.css\");\n",
       "      Bokeh.embed.inject_css(\"https://cdn.pydata.org/bokeh/release/bokeh-widgets-0.12.7.min.css\");\n",
       "      console.log(\"Bokeh: injecting CSS: https://cdn.pydata.org/bokeh/release/bokeh-tables-0.12.7.min.css\");\n",
       "      Bokeh.embed.inject_css(\"https://cdn.pydata.org/bokeh/release/bokeh-tables-0.12.7.min.css\");\n",
       "    }\n",
       "  ];\n",
       "\n",
       "  function run_inline_js() {\n",
       "    \n",
       "    if ((root.Bokeh !== undefined) || (force === true)) {\n",
       "      for (var i = 0; i < inline_js.length; i++) {\n",
       "        inline_js[i].call(root, root.Bokeh);\n",
       "      }if (force === true) {\n",
       "        display_loaded();\n",
       "      }} else if (Date.now() < root._bokeh_timeout) {\n",
       "      setTimeout(run_inline_js, 100);\n",
       "    } else if (!root._bokeh_failed_load) {\n",
       "      console.log(\"Bokeh: BokehJS failed to load within specified timeout.\");\n",
       "      root._bokeh_failed_load = true;\n",
       "    } else if (force !== true) {\n",
       "      var cell = $(document.getElementById(\"4719d191-f3bf-430d-b5db-cd60338170a4\")).parents('.cell').data().cell;\n",
       "      cell.output_area.append_execute_result(NB_LOAD_WARNING)\n",
       "    }\n",
       "\n",
       "  }\n",
       "\n",
       "  if (root._bokeh_is_loading === 0) {\n",
       "    console.log(\"Bokeh: BokehJS loaded, going straight to plotting\");\n",
       "    run_inline_js();\n",
       "  } else {\n",
       "    load_libs(js_urls, function() {\n",
       "      console.log(\"Bokeh: BokehJS plotting callback run at\", now());\n",
       "      run_inline_js();\n",
       "    });\n",
       "  }\n",
       "}(window));"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/html": [
       "\n",
       "\n",
       "    <div class=\"bk-root\">\n",
       "        <div class=\"bk-plotdiv\" id=\"81a66ada-6be4-4ae4-8a67-dbbeecbca67b\"></div>\n",
       "    </div>\n",
       "<script type=\"text/javascript\">\n",
       "  \n",
       "  (function(root) {\n",
       "    function now() {\n",
       "      return new Date();\n",
       "    }\n",
       "  \n",
       "    var force = false;\n",
       "  \n",
       "    if (typeof (root._bokeh_onload_callbacks) === \"undefined\" || force === true) {\n",
       "      root._bokeh_onload_callbacks = [];\n",
       "      root._bokeh_is_loading = undefined;\n",
       "    }\n",
       "  \n",
       "  \n",
       "    \n",
       "    if (typeof (root._bokeh_timeout) === \"undefined\" || force === true) {\n",
       "      root._bokeh_timeout = Date.now() + 0;\n",
       "      root._bokeh_failed_load = false;\n",
       "    }\n",
       "  \n",
       "    var NB_LOAD_WARNING = {'data': {'text/html':\n",
       "       \"<div style='background-color: #fdd'>\\n\"+\n",
       "       \"<p>\\n\"+\n",
       "       \"BokehJS does not appear to have successfully loaded. If loading BokehJS from CDN, this \\n\"+\n",
       "       \"may be due to a slow or bad network connection. Possible fixes:\\n\"+\n",
       "       \"</p>\\n\"+\n",
       "       \"<ul>\\n\"+\n",
       "       \"<li>re-rerun `output_notebook()` to attempt to load from CDN again, or</li>\\n\"+\n",
       "       \"<li>use INLINE resources instead, as so:</li>\\n\"+\n",
       "       \"</ul>\\n\"+\n",
       "       \"<code>\\n\"+\n",
       "       \"from bokeh.resources import INLINE\\n\"+\n",
       "       \"output_notebook(resources=INLINE)\\n\"+\n",
       "       \"</code>\\n\"+\n",
       "       \"</div>\"}};\n",
       "  \n",
       "    function display_loaded() {\n",
       "      if (root.Bokeh !== undefined) {\n",
       "        var el = document.getElementById(\"81a66ada-6be4-4ae4-8a67-dbbeecbca67b\");\n",
       "        if (el != null) {\n",
       "          el.textContent = \"BokehJS \" + Bokeh.version + \" successfully loaded.\";\n",
       "        }\n",
       "      } else if (Date.now() < root._bokeh_timeout) {\n",
       "        setTimeout(display_loaded, 100)\n",
       "      }\n",
       "    }\n",
       "  \n",
       "  \n",
       "    function run_callbacks() {\n",
       "      try {\n",
       "        root._bokeh_onload_callbacks.forEach(function(callback) { callback() });\n",
       "      }\n",
       "      finally {\n",
       "        delete root._bokeh_onload_callbacks\n",
       "      }\n",
       "      console.info(\"Bokeh: all callbacks have finished\");\n",
       "    }\n",
       "  \n",
       "    function load_libs(js_urls, callback) {\n",
       "      root._bokeh_onload_callbacks.push(callback);\n",
       "      if (root._bokeh_is_loading > 0) {\n",
       "        console.log(\"Bokeh: BokehJS is being loaded, scheduling callback at\", now());\n",
       "        return null;\n",
       "      }\n",
       "      if (js_urls == null || js_urls.length === 0) {\n",
       "        run_callbacks();\n",
       "        return null;\n",
       "      }\n",
       "      console.log(\"Bokeh: BokehJS not loaded, scheduling load and callback at\", now());\n",
       "      root._bokeh_is_loading = js_urls.length;\n",
       "      for (var i = 0; i < js_urls.length; i++) {\n",
       "        var url = js_urls[i];\n",
       "        var s = document.createElement('script');\n",
       "        s.src = url;\n",
       "        s.async = false;\n",
       "        s.onreadystatechange = s.onload = function() {\n",
       "          root._bokeh_is_loading--;\n",
       "          if (root._bokeh_is_loading === 0) {\n",
       "            console.log(\"Bokeh: all BokehJS libraries loaded\");\n",
       "            run_callbacks()\n",
       "          }\n",
       "        };\n",
       "        s.onerror = function() {\n",
       "          console.warn(\"failed to load library \" + url);\n",
       "        };\n",
       "        console.log(\"Bokeh: injecting script tag for BokehJS library: \", url);\n",
       "        document.getElementsByTagName(\"head\")[0].appendChild(s);\n",
       "      }\n",
       "    };var element = document.getElementById(\"81a66ada-6be4-4ae4-8a67-dbbeecbca67b\");\n",
       "    if (element == null) {\n",
       "      console.log(\"Bokeh: ERROR: autoload.js configured with elementid '81a66ada-6be4-4ae4-8a67-dbbeecbca67b' but no matching script tag was found. \")\n",
       "      return false;\n",
       "    }\n",
       "  \n",
       "    var js_urls = [];\n",
       "  \n",
       "    var inline_js = [\n",
       "      function(Bokeh) {\n",
       "        (function() {\n",
       "          var fn = function() {\n",
       "            var docs_json = {\"6da61a3e-60cb-48c4-8a76-6789a1160c3b\":{\"roots\":{\"references\":[{\"attributes\":{\"plot\":{\"id\":\"e682dfb5-d70f-467d-83da-b4f95f57300d\",\"subtype\":\"Figure\",\"type\":\"Plot\"},\"ticker\":{\"id\":\"48897c11-de42-4f78-8c74-5eaec3a409e6\",\"type\":\"BasicTicker\"}},\"id\":\"1be5dbd1-4325-40eb-aaa6-bd5b8eaa55e1\",\"type\":\"Grid\"},{\"attributes\":{},\"id\":\"c2b40be6-2f9d-4fe2-a09f-e7b1095a941e\",\"type\":\"PanTool\"},{\"attributes\":{},\"id\":\"48897c11-de42-4f78-8c74-5eaec3a409e6\",\"type\":\"BasicTicker\"},{\"attributes\":{},\"id\":\"8d357f9b-3d80-45cf-8249-c40b65c1c804\",\"type\":\"BasicTickFormatter\"},{\"attributes\":{\"data_source\":{\"id\":\"ed38ac50-724d-4fef-8ece-378caaf9441d\",\"type\":\"ColumnDataSource\"},\"glyph\":{\"id\":\"b44c6305-f33f-4b17-b40c-fed6a8db0868\",\"type\":\"Line\"},\"hover_glyph\":null,\"muted_glyph\":null,\"nonselection_glyph\":{\"id\":\"3227e1aa-c4ce-40a8-841f-80986b12d699\",\"type\":\"Line\"},\"selection_glyph\":null,\"view\":{\"id\":\"4039d79c-a72c-470c-9ac8-61d23c8fc1ff\",\"type\":\"CDSView\"}},\"id\":\"5000c8bc-15e0-4d9f-9176-8f6889abb082\",\"type\":\"GlyphRenderer\"},{\"attributes\":{},\"id\":\"f5eb3bf1-9fc0-480a-8a54-82d9998d0358\",\"type\":\"BasicTickFormatter\"},{\"attributes\":{},\"id\":\"df04f7d1-907f-4502-9427-79492186ba9a\",\"type\":\"LinearScale\"},{\"attributes\":{\"overlay\":{\"id\":\"1d3cd41c-198c-4a99-a268-91533f1453f2\",\"type\":\"BoxAnnotation\"}},\"id\":\"8f1db3fe-34b7-45fa-bd70-171a5cc529b0\",\"type\":\"BoxZoomTool\"},{\"attributes\":{},\"id\":\"7947872f-9d8e-4d22-8b8f-f0ce0318c93c\",\"type\":\"WheelZoomTool\"},{\"attributes\":{\"callback\":null},\"id\":\"fd584aca-2cba-4a79-a8da-ed13c3ba6c2e\",\"type\":\"DataRange1d\"},{\"attributes\":{},\"id\":\"c0e083f3-b2d6-45c9-ace8-af57b9cb597b\",\"type\":\"BasicTickFormatter\"},{\"attributes\":{},\"id\":\"c510d534-98e5-4d6a-849a-cda2b4f90e49\",\"type\":\"LinearScale\"},{\"attributes\":{},\"id\":\"d1fc912c-ab84-471b-a1be-eccf68799122\",\"type\":\"BasicTicker\"},{\"attributes\":{},\"id\":\"f1fa55c2-a08c-4065-ae8b-86dbaf213612\",\"type\":\"LinearScale\"},{\"attributes\":{},\"id\":\"3cbb2fa9-9791-4a66-8739-ead73ec31b0c\",\"type\":\"SaveTool\"},{\"attributes\":{},\"id\":\"4a5795b7-d3cd-4a30-9629-984fc54425b9\",\"type\":\"LinearScale\"},{\"attributes\":{\"callback\":null,\"column_names\":[\"x\",\"y\"],\"data\":{\"x\":[1,2,3,\"NaN\",4,5],\"y\":[6,7,2,4,4,5]}},\"id\":\"83ce22bc-cf44-49b4-8bd5-25172330087c\",\"type\":\"ColumnDataSource\"},{\"attributes\":{\"callback\":null},\"id\":\"d81b33da-b105-4ff4-9f67-75253c87914e\",\"type\":\"DataRange1d\"},{\"attributes\":{\"formatter\":{\"id\":\"4e3bd09d-1080-4c4d-86ba-2ff4f4d093f6\",\"type\":\"BasicTickFormatter\"},\"plot\":{\"id\":\"b2914993-b755-4d6c-b943-bd1b04fed8c7\",\"subtype\":\"Figure\",\"type\":\"Plot\"},\"ticker\":{\"id\":\"6ac2e892-07c9-464b-b379-1679d60ea1c2\",\"type\":\"BasicTicker\"}},\"id\":\"c14a7607-7004-41d0-9592-ff32f541d0cb\",\"type\":\"LinearAxis\"},{\"attributes\":{\"formatter\":{\"id\":\"c0e083f3-b2d6-45c9-ace8-af57b9cb597b\",\"type\":\"BasicTickFormatter\"},\"plot\":{\"id\":\"b2914993-b755-4d6c-b943-bd1b04fed8c7\",\"subtype\":\"Figure\",\"type\":\"Plot\"},\"ticker\":{\"id\":\"d1fc912c-ab84-471b-a1be-eccf68799122\",\"type\":\"BasicTicker\"}},\"id\":\"e987d192-46e3-414b-b0e8-6364150bafe6\",\"type\":\"LinearAxis\"},{\"attributes\":{\"formatter\":{\"id\":\"f5eb3bf1-9fc0-480a-8a54-82d9998d0358\",\"type\":\"BasicTickFormatter\"},\"plot\":{\"id\":\"e682dfb5-d70f-467d-83da-b4f95f57300d\",\"subtype\":\"Figure\",\"type\":\"Plot\"},\"ticker\":{\"id\":\"48897c11-de42-4f78-8c74-5eaec3a409e6\",\"type\":\"BasicTicker\"}},\"id\":\"daaa6b5a-3e04-442f-9176-a4fcc5390149\",\"type\":\"LinearAxis\"},{\"attributes\":{\"source\":{\"id\":\"ed38ac50-724d-4fef-8ece-378caaf9441d\",\"type\":\"ColumnDataSource\"}},\"id\":\"4039d79c-a72c-470c-9ac8-61d23c8fc1ff\",\"type\":\"CDSView\"},{\"attributes\":{},\"id\":\"016f74b8-f101-4dde-815c-029881457385\",\"type\":\"ResetTool\"},{\"attributes\":{\"data_source\":{\"id\":\"83ce22bc-cf44-49b4-8bd5-25172330087c\",\"type\":\"ColumnDataSource\"},\"glyph\":{\"id\":\"692e9d76-55a2-452d-acf9-da8b6631a03d\",\"type\":\"Line\"},\"hover_glyph\":null,\"muted_glyph\":null,\"nonselection_glyph\":{\"id\":\"3423db24-7e9c-4c4c-9458-d4fd9122fe8c\",\"type\":\"Line\"},\"selection_glyph\":null,\"view\":{\"id\":\"8d8e7412-c773-4c8c-875d-96347f6ea9fc\",\"type\":\"CDSView\"}},\"id\":\"f9944c9f-d185-4972-9b8f-6034e0b75964\",\"type\":\"GlyphRenderer\"},{\"attributes\":{\"bottom_units\":\"screen\",\"fill_alpha\":{\"value\":0.5},\"fill_color\":{\"value\":\"lightgrey\"},\"left_units\":\"screen\",\"level\":\"overlay\",\"line_alpha\":{\"value\":1.0},\"line_color\":{\"value\":\"black\"},\"line_dash\":[4,4],\"line_width\":{\"value\":2},\"plot\":null,\"render_mode\":\"css\",\"right_units\":\"screen\",\"top_units\":\"screen\"},\"id\":\"4f473f6c-9a1a-4cc9-868c-45898440b8dc\",\"type\":\"BoxAnnotation\"},{\"attributes\":{\"plot\":{\"id\":\"b2914993-b755-4d6c-b943-bd1b04fed8c7\",\"subtype\":\"Figure\",\"type\":\"Plot\"},\"ticker\":{\"id\":\"d1fc912c-ab84-471b-a1be-eccf68799122\",\"type\":\"BasicTicker\"}},\"id\":\"43512911-6e86-44eb-9d09-3cf13575705d\",\"type\":\"Grid\"},{\"attributes\":{\"source\":{\"id\":\"83ce22bc-cf44-49b4-8bd5-25172330087c\",\"type\":\"ColumnDataSource\"}},\"id\":\"8d8e7412-c773-4c8c-875d-96347f6ea9fc\",\"type\":\"CDSView\"},{\"attributes\":{\"below\":[{\"id\":\"daaa6b5a-3e04-442f-9176-a4fcc5390149\",\"type\":\"LinearAxis\"}],\"left\":[{\"id\":\"1772ae0e-4be5-4964-8ae8-b13e812673a5\",\"type\":\"LinearAxis\"}],\"plot_height\":250,\"plot_width\":250,\"renderers\":[{\"id\":\"daaa6b5a-3e04-442f-9176-a4fcc5390149\",\"type\":\"LinearAxis\"},{\"id\":\"1be5dbd1-4325-40eb-aaa6-bd5b8eaa55e1\",\"type\":\"Grid\"},{\"id\":\"1772ae0e-4be5-4964-8ae8-b13e812673a5\",\"type\":\"LinearAxis\"},{\"id\":\"959e116a-7f26-43bd-b166-12956d1195c1\",\"type\":\"Grid\"},{\"id\":\"4f473f6c-9a1a-4cc9-868c-45898440b8dc\",\"type\":\"BoxAnnotation\"},{\"id\":\"5000c8bc-15e0-4d9f-9176-8f6889abb082\",\"type\":\"GlyphRenderer\"}],\"title\":{\"id\":\"36b7ecd2-5eea-4dc6-a8fc-9fb201dd07bc\",\"type\":\"Title\"},\"toolbar\":{\"id\":\"aca94451-2435-41f9-9bc4-f21db69a86a6\",\"type\":\"Toolbar\"},\"toolbar_location\":null,\"x_range\":{\"id\":\"d81b33da-b105-4ff4-9f67-75253c87914e\",\"type\":\"DataRange1d\"},\"x_scale\":{\"id\":\"df04f7d1-907f-4502-9427-79492186ba9a\",\"type\":\"LinearScale\"},\"y_range\":{\"id\":\"39964ea6-caa1-4339-a70e-05089123a5d9\",\"type\":\"DataRange1d\"},\"y_scale\":{\"id\":\"c510d534-98e5-4d6a-849a-cda2b4f90e49\",\"type\":\"LinearScale\"}},\"id\":\"e682dfb5-d70f-467d-83da-b4f95f57300d\",\"subtype\":\"Figure\",\"type\":\"Plot\"},{\"attributes\":{},\"id\":\"237fe7a8-2ba8-47c6-a54e-2cca04ab48d9\",\"type\":\"HelpTool\"},{\"attributes\":{\"active_drag\":\"auto\",\"active_inspect\":\"auto\",\"active_scroll\":\"auto\",\"active_tap\":\"auto\",\"tools\":[{\"id\":\"4414e3bc-fd12-45c3-abf3-72e790a25263\",\"type\":\"PanTool\"},{\"id\":\"3539ad5f-363e-43d4-83a0-b57bad04b8ae\",\"type\":\"WheelZoomTool\"},{\"id\":\"8f1db3fe-34b7-45fa-bd70-171a5cc529b0\",\"type\":\"BoxZoomTool\"},{\"id\":\"9a462697-ef7a-4a14-b6b7-ec97fe9611ac\",\"type\":\"SaveTool\"},{\"id\":\"016f74b8-f101-4dde-815c-029881457385\",\"type\":\"ResetTool\"},{\"id\":\"237fe7a8-2ba8-47c6-a54e-2cca04ab48d9\",\"type\":\"HelpTool\"}]},\"id\":\"973f9ff8-25d6-4a77-9b1b-573473473b1f\",\"type\":\"Toolbar\"},{\"attributes\":{\"line_width\":{\"value\":2},\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"692e9d76-55a2-452d-acf9-da8b6631a03d\",\"type\":\"Line\"},{\"attributes\":{\"active_drag\":\"auto\",\"active_inspect\":\"auto\",\"active_scroll\":\"auto\",\"active_tap\":\"auto\",\"tools\":[{\"id\":\"c2b40be6-2f9d-4fe2-a09f-e7b1095a941e\",\"type\":\"PanTool\"},{\"id\":\"7947872f-9d8e-4d22-8b8f-f0ce0318c93c\",\"type\":\"WheelZoomTool\"},{\"id\":\"02db02ce-9355-405c-987f-7663da4b0244\",\"type\":\"BoxZoomTool\"},{\"id\":\"3cbb2fa9-9791-4a66-8739-ead73ec31b0c\",\"type\":\"SaveTool\"},{\"id\":\"e6b8bd04-a38a-40a6-b5cb-b8d03936b9f5\",\"type\":\"ResetTool\"},{\"id\":\"1543239a-399b-4a4f-a8f8-e12f2c5056e9\",\"type\":\"HelpTool\"}]},\"id\":\"aca94451-2435-41f9-9bc4-f21db69a86a6\",\"type\":\"Toolbar\"},{\"attributes\":{},\"id\":\"1543239a-399b-4a4f-a8f8-e12f2c5056e9\",\"type\":\"HelpTool\"},{\"attributes\":{},\"id\":\"9a462697-ef7a-4a14-b6b7-ec97fe9611ac\",\"type\":\"SaveTool\"},{\"attributes\":{\"line_alpha\":{\"value\":0.1},\"line_color\":{\"value\":\"#1f77b4\"},\"line_width\":{\"value\":2},\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"3227e1aa-c4ce-40a8-841f-80986b12d699\",\"type\":\"Line\"},{\"attributes\":{\"below\":[{\"id\":\"e987d192-46e3-414b-b0e8-6364150bafe6\",\"type\":\"LinearAxis\"}],\"left\":[{\"id\":\"c14a7607-7004-41d0-9592-ff32f541d0cb\",\"type\":\"LinearAxis\"}],\"plot_height\":250,\"plot_width\":250,\"renderers\":[{\"id\":\"e987d192-46e3-414b-b0e8-6364150bafe6\",\"type\":\"LinearAxis\"},{\"id\":\"43512911-6e86-44eb-9d09-3cf13575705d\",\"type\":\"Grid\"},{\"id\":\"c14a7607-7004-41d0-9592-ff32f541d0cb\",\"type\":\"LinearAxis\"},{\"id\":\"7c631a35-dd10-4d05-8ecc-20a13cae9ea6\",\"type\":\"Grid\"},{\"id\":\"1d3cd41c-198c-4a99-a268-91533f1453f2\",\"type\":\"BoxAnnotation\"},{\"id\":\"f9944c9f-d185-4972-9b8f-6034e0b75964\",\"type\":\"GlyphRenderer\"}],\"title\":{\"id\":\"c4817dd9-a27d-461b-a91f-2d5b4e26683b\",\"type\":\"Title\"},\"toolbar\":{\"id\":\"973f9ff8-25d6-4a77-9b1b-573473473b1f\",\"type\":\"Toolbar\"},\"toolbar_location\":null,\"x_range\":{\"id\":\"fe732a8b-f42f-4edd-af08-37436a1e253f\",\"type\":\"DataRange1d\"},\"x_scale\":{\"id\":\"4a5795b7-d3cd-4a30-9629-984fc54425b9\",\"type\":\"LinearScale\"},\"y_range\":{\"id\":\"fd584aca-2cba-4a79-a8da-ed13c3ba6c2e\",\"type\":\"DataRange1d\"},\"y_scale\":{\"id\":\"f1fa55c2-a08c-4065-ae8b-86dbaf213612\",\"type\":\"LinearScale\"}},\"id\":\"b2914993-b755-4d6c-b943-bd1b04fed8c7\",\"subtype\":\"Figure\",\"type\":\"Plot\"},{\"attributes\":{\"dimension\":1,\"plot\":{\"id\":\"b2914993-b755-4d6c-b943-bd1b04fed8c7\",\"subtype\":\"Figure\",\"type\":\"Plot\"},\"ticker\":{\"id\":\"6ac2e892-07c9-464b-b379-1679d60ea1c2\",\"type\":\"BasicTicker\"}},\"id\":\"7c631a35-dd10-4d05-8ecc-20a13cae9ea6\",\"type\":\"Grid\"},{\"attributes\":{\"children\":[{\"id\":\"e682dfb5-d70f-467d-83da-b4f95f57300d\",\"subtype\":\"Figure\",\"type\":\"Plot\"},{\"id\":\"b2914993-b755-4d6c-b943-bd1b04fed8c7\",\"subtype\":\"Figure\",\"type\":\"Plot\"}]},\"id\":\"c6d22934-f2b0-458b-9b30-f78368391829\",\"type\":\"Row\"},{\"attributes\":{\"children\":[{\"id\":\"79651f53-cbcf-4434-8532-2641143157fe\",\"type\":\"ToolbarBox\"},{\"id\":\"867ab34d-7e95-41f3-89e2-8b63697c8ffa\",\"type\":\"Column\"}]},\"id\":\"7b0a916d-f8f6-4a83-9688-eadcb92d6c1e\",\"type\":\"Column\"},{\"attributes\":{},\"id\":\"d2f05767-1248-4672-b416-34a0de346fea\",\"type\":\"BasicTicker\"},{\"attributes\":{\"line_alpha\":{\"value\":0.1},\"line_color\":{\"value\":\"#1f77b4\"},\"line_width\":{\"value\":2},\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"3423db24-7e9c-4c4c-9458-d4fd9122fe8c\",\"type\":\"Line\"},{\"attributes\":{\"dimension\":1,\"plot\":{\"id\":\"e682dfb5-d70f-467d-83da-b4f95f57300d\",\"subtype\":\"Figure\",\"type\":\"Plot\"},\"ticker\":{\"id\":\"d2f05767-1248-4672-b416-34a0de346fea\",\"type\":\"BasicTicker\"}},\"id\":\"959e116a-7f26-43bd-b166-12956d1195c1\",\"type\":\"Grid\"},{\"attributes\":{},\"id\":\"3539ad5f-363e-43d4-83a0-b57bad04b8ae\",\"type\":\"WheelZoomTool\"},{\"attributes\":{\"sizing_mode\":\"scale_width\",\"toolbar_location\":\"above\",\"tools\":[{\"id\":\"c2b40be6-2f9d-4fe2-a09f-e7b1095a941e\",\"type\":\"PanTool\"},{\"id\":\"7947872f-9d8e-4d22-8b8f-f0ce0318c93c\",\"type\":\"WheelZoomTool\"},{\"id\":\"02db02ce-9355-405c-987f-7663da4b0244\",\"type\":\"BoxZoomTool\"},{\"id\":\"3cbb2fa9-9791-4a66-8739-ead73ec31b0c\",\"type\":\"SaveTool\"},{\"id\":\"e6b8bd04-a38a-40a6-b5cb-b8d03936b9f5\",\"type\":\"ResetTool\"},{\"id\":\"1543239a-399b-4a4f-a8f8-e12f2c5056e9\",\"type\":\"HelpTool\"},{\"id\":\"4414e3bc-fd12-45c3-abf3-72e790a25263\",\"type\":\"PanTool\"},{\"id\":\"3539ad5f-363e-43d4-83a0-b57bad04b8ae\",\"type\":\"WheelZoomTool\"},{\"id\":\"8f1db3fe-34b7-45fa-bd70-171a5cc529b0\",\"type\":\"BoxZoomTool\"},{\"id\":\"9a462697-ef7a-4a14-b6b7-ec97fe9611ac\",\"type\":\"SaveTool\"},{\"id\":\"016f74b8-f101-4dde-815c-029881457385\",\"type\":\"ResetTool\"},{\"id\":\"237fe7a8-2ba8-47c6-a54e-2cca04ab48d9\",\"type\":\"HelpTool\"}]},\"id\":\"79651f53-cbcf-4434-8532-2641143157fe\",\"type\":\"ToolbarBox\"},{\"attributes\":{\"bottom_units\":\"screen\",\"fill_alpha\":{\"value\":0.5},\"fill_color\":{\"value\":\"lightgrey\"},\"left_units\":\"screen\",\"level\":\"overlay\",\"line_alpha\":{\"value\":1.0},\"line_color\":{\"value\":\"black\"},\"line_dash\":[4,4],\"line_width\":{\"value\":2},\"plot\":null,\"render_mode\":\"css\",\"right_units\":\"screen\",\"top_units\":\"screen\"},\"id\":\"1d3cd41c-198c-4a99-a268-91533f1453f2\",\"type\":\"BoxAnnotation\"},{\"attributes\":{\"overlay\":{\"id\":\"4f473f6c-9a1a-4cc9-868c-45898440b8dc\",\"type\":\"BoxAnnotation\"}},\"id\":\"02db02ce-9355-405c-987f-7663da4b0244\",\"type\":\"BoxZoomTool\"},{\"attributes\":{},\"id\":\"6ac2e892-07c9-464b-b379-1679d60ea1c2\",\"type\":\"BasicTicker\"},{\"attributes\":{},\"id\":\"4e3bd09d-1080-4c4d-86ba-2ff4f4d093f6\",\"type\":\"BasicTickFormatter\"},{\"attributes\":{},\"id\":\"4414e3bc-fd12-45c3-abf3-72e790a25263\",\"type\":\"PanTool\"},{\"attributes\":{\"callback\":null,\"column_names\":[\"x\",\"y\"],\"data\":{\"x\":[1,2,3,\"NaN\",4,5],\"y\":[6,7,2,4,4,5]}},\"id\":\"ed38ac50-724d-4fef-8ece-378caaf9441d\",\"type\":\"ColumnDataSource\"},{\"attributes\":{\"plot\":null,\"text\":\"\"},\"id\":\"36b7ecd2-5eea-4dc6-a8fc-9fb201dd07bc\",\"type\":\"Title\"},{\"attributes\":{\"callback\":null},\"id\":\"39964ea6-caa1-4339-a70e-05089123a5d9\",\"type\":\"DataRange1d\"},{\"attributes\":{\"plot\":null,\"text\":\"\"},\"id\":\"c4817dd9-a27d-461b-a91f-2d5b4e26683b\",\"type\":\"Title\"},{\"attributes\":{},\"id\":\"e6b8bd04-a38a-40a6-b5cb-b8d03936b9f5\",\"type\":\"ResetTool\"},{\"attributes\":{\"line_color\":{\"value\":\"navy\"},\"line_width\":{\"value\":2},\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"b44c6305-f33f-4b17-b40c-fed6a8db0868\",\"type\":\"Line\"},{\"attributes\":{\"formatter\":{\"id\":\"8d357f9b-3d80-45cf-8249-c40b65c1c804\",\"type\":\"BasicTickFormatter\"},\"plot\":{\"id\":\"e682dfb5-d70f-467d-83da-b4f95f57300d\",\"subtype\":\"Figure\",\"type\":\"Plot\"},\"ticker\":{\"id\":\"d2f05767-1248-4672-b416-34a0de346fea\",\"type\":\"BasicTicker\"}},\"id\":\"1772ae0e-4be5-4964-8ae8-b13e812673a5\",\"type\":\"LinearAxis\"},{\"attributes\":{\"children\":[{\"id\":\"c6d22934-f2b0-458b-9b30-f78368391829\",\"type\":\"Row\"}]},\"id\":\"867ab34d-7e95-41f3-89e2-8b63697c8ffa\",\"type\":\"Column\"},{\"attributes\":{\"callback\":null},\"id\":\"fe732a8b-f42f-4edd-af08-37436a1e253f\",\"type\":\"DataRange1d\"}],\"root_ids\":[\"7b0a916d-f8f6-4a83-9688-eadcb92d6c1e\"]},\"title\":\"Bokeh Application\",\"version\":\"0.12.7\"}};\n",
       "            var render_items = [{\"docid\":\"6da61a3e-60cb-48c4-8a76-6789a1160c3b\",\"elementid\":\"81a66ada-6be4-4ae4-8a67-dbbeecbca67b\",\"modelid\":\"7b0a916d-f8f6-4a83-9688-eadcb92d6c1e\"}];\n",
       "            \n",
       "            Bokeh.embed.embed_items(docs_json, render_items);\n",
       "          };\n",
       "          if (document.readyState != \"loading\") fn();\n",
       "          else document.addEventListener(\"DOMContentLoaded\", fn);\n",
       "        })();\n",
       "      },\n",
       "      function(Bokeh) {\n",
       "      }\n",
       "    ];\n",
       "  \n",
       "    function run_inline_js() {\n",
       "      \n",
       "      if ((root.Bokeh !== undefined) || (force === true)) {\n",
       "        for (var i = 0; i < inline_js.length; i++) {\n",
       "          inline_js[i].call(root, root.Bokeh);\n",
       "        }if (force === true) {\n",
       "          display_loaded();\n",
       "        }} else if (Date.now() < root._bokeh_timeout) {\n",
       "        setTimeout(run_inline_js, 100);\n",
       "      } else if (!root._bokeh_failed_load) {\n",
       "        console.log(\"Bokeh: BokehJS failed to load within specified timeout.\");\n",
       "        root._bokeh_failed_load = true;\n",
       "      } else if (force !== true) {\n",
       "        var cell = $(document.getElementById(\"81a66ada-6be4-4ae4-8a67-dbbeecbca67b\")).parents('.cell').data().cell;\n",
       "        cell.output_area.append_execute_result(NB_LOAD_WARNING)\n",
       "      }\n",
       "  \n",
       "    }\n",
       "  \n",
       "    if (root._bokeh_is_loading === 0) {\n",
       "      console.log(\"Bokeh: BokehJS loaded, going straight to plotting\");\n",
       "      run_inline_js();\n",
       "    } else {\n",
       "      load_libs(js_urls, function() {\n",
       "        console.log(\"Bokeh: BokehJS plotting callback run at\", now());\n",
       "        run_inline_js();\n",
       "      });\n",
       "    }\n",
       "  }(window));\n",
       "</script>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "#nan值可以传递到line和multi_line,数据处理为会缺失值\n",
    "from bokeh.layouts import gridplot\n",
    "from bokeh.plotting import figure, output_notebook, show\n",
    "\n",
    "output_notebook()\n",
    "p1=figure(plot_width=250, plot_height=250)\n",
    "p2=figure(plot_width=250, plot_height=250)\n",
    "\n",
    "#add a line rendered with a Nan\n",
    "#强制转为浮点值, float('nan')=np.NaN\n",
    "nan=float('nan')     \n",
    "x1=[1,2,3,nan,4,5]\n",
    "x2=[1,2,3,np.NaN,4,5]\n",
    "y0=[6,7,2,4,4,5]\n",
    "p1.line(x=x1,y=y0,line_width=2,color=\"navy\")\n",
    "p2.line(x=x2,y=y0,line_width=2,color=\"black\")\n",
    "\n",
    "p=gridplot([[p1,p2]])\n",
    "\n",
    "show(p)\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 39,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "\n",
       "    <div class=\"bk-root\">\n",
       "        <a href=\"https://bokeh.pydata.org\" target=\"_blank\" class=\"bk-logo bk-logo-small bk-logo-notebook\"></a>\n",
       "        <span id=\"d2b97aa0-a5b3-4c4d-bf03-4b97d6c642d6\">Loading BokehJS ...</span>\n",
       "    </div>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "application/javascript": [
       "\n",
       "(function(root) {\n",
       "  function now() {\n",
       "    return new Date();\n",
       "  }\n",
       "\n",
       "  var force = true;\n",
       "\n",
       "  if (typeof (root._bokeh_onload_callbacks) === \"undefined\" || force === true) {\n",
       "    root._bokeh_onload_callbacks = [];\n",
       "    root._bokeh_is_loading = undefined;\n",
       "  }\n",
       "\n",
       "\n",
       "  \n",
       "  if (typeof (root._bokeh_timeout) === \"undefined\" || force === true) {\n",
       "    root._bokeh_timeout = Date.now() + 5000;\n",
       "    root._bokeh_failed_load = false;\n",
       "  }\n",
       "\n",
       "  var NB_LOAD_WARNING = {'data': {'text/html':\n",
       "     \"<div style='background-color: #fdd'>\\n\"+\n",
       "     \"<p>\\n\"+\n",
       "     \"BokehJS does not appear to have successfully loaded. If loading BokehJS from CDN, this \\n\"+\n",
       "     \"may be due to a slow or bad network connection. Possible fixes:\\n\"+\n",
       "     \"</p>\\n\"+\n",
       "     \"<ul>\\n\"+\n",
       "     \"<li>re-rerun `output_notebook()` to attempt to load from CDN again, or</li>\\n\"+\n",
       "     \"<li>use INLINE resources instead, as so:</li>\\n\"+\n",
       "     \"</ul>\\n\"+\n",
       "     \"<code>\\n\"+\n",
       "     \"from bokeh.resources import INLINE\\n\"+\n",
       "     \"output_notebook(resources=INLINE)\\n\"+\n",
       "     \"</code>\\n\"+\n",
       "     \"</div>\"}};\n",
       "\n",
       "  function display_loaded() {\n",
       "    if (root.Bokeh !== undefined) {\n",
       "      var el = document.getElementById(\"d2b97aa0-a5b3-4c4d-bf03-4b97d6c642d6\");\n",
       "      if (el != null) {\n",
       "        el.textContent = \"BokehJS \" + Bokeh.version + \" successfully loaded.\";\n",
       "      }\n",
       "    } else if (Date.now() < root._bokeh_timeout) {\n",
       "      setTimeout(display_loaded, 100)\n",
       "    }\n",
       "  }\n",
       "\n",
       "\n",
       "  function run_callbacks() {\n",
       "    try {\n",
       "      root._bokeh_onload_callbacks.forEach(function(callback) { callback() });\n",
       "    }\n",
       "    finally {\n",
       "      delete root._bokeh_onload_callbacks\n",
       "    }\n",
       "    console.info(\"Bokeh: all callbacks have finished\");\n",
       "  }\n",
       "\n",
       "  function load_libs(js_urls, callback) {\n",
       "    root._bokeh_onload_callbacks.push(callback);\n",
       "    if (root._bokeh_is_loading > 0) {\n",
       "      console.log(\"Bokeh: BokehJS is being loaded, scheduling callback at\", now());\n",
       "      return null;\n",
       "    }\n",
       "    if (js_urls == null || js_urls.length === 0) {\n",
       "      run_callbacks();\n",
       "      return null;\n",
       "    }\n",
       "    console.log(\"Bokeh: BokehJS not loaded, scheduling load and callback at\", now());\n",
       "    root._bokeh_is_loading = js_urls.length;\n",
       "    for (var i = 0; i < js_urls.length; i++) {\n",
       "      var url = js_urls[i];\n",
       "      var s = document.createElement('script');\n",
       "      s.src = url;\n",
       "      s.async = false;\n",
       "      s.onreadystatechange = s.onload = function() {\n",
       "        root._bokeh_is_loading--;\n",
       "        if (root._bokeh_is_loading === 0) {\n",
       "          console.log(\"Bokeh: all BokehJS libraries loaded\");\n",
       "          run_callbacks()\n",
       "        }\n",
       "      };\n",
       "      s.onerror = function() {\n",
       "        console.warn(\"failed to load library \" + url);\n",
       "      };\n",
       "      console.log(\"Bokeh: injecting script tag for BokehJS library: \", url);\n",
       "      document.getElementsByTagName(\"head\")[0].appendChild(s);\n",
       "    }\n",
       "  };var element = document.getElementById(\"d2b97aa0-a5b3-4c4d-bf03-4b97d6c642d6\");\n",
       "  if (element == null) {\n",
       "    console.log(\"Bokeh: ERROR: autoload.js configured with elementid 'd2b97aa0-a5b3-4c4d-bf03-4b97d6c642d6' but no matching script tag was found. \")\n",
       "    return false;\n",
       "  }\n",
       "\n",
       "  var js_urls = [\"https://cdn.pydata.org/bokeh/release/bokeh-0.12.7.min.js\", \"https://cdn.pydata.org/bokeh/release/bokeh-widgets-0.12.7.min.js\", \"https://cdn.pydata.org/bokeh/release/bokeh-tables-0.12.7.min.js\", \"https://cdn.pydata.org/bokeh/release/bokeh-gl-0.12.7.min.js\"];\n",
       "\n",
       "  var inline_js = [\n",
       "    function(Bokeh) {\n",
       "      Bokeh.set_log_level(\"info\");\n",
       "    },\n",
       "    \n",
       "    function(Bokeh) {\n",
       "      \n",
       "    },\n",
       "    \n",
       "    function(Bokeh) {\n",
       "      \n",
       "      document.getElementById(\"d2b97aa0-a5b3-4c4d-bf03-4b97d6c642d6\").textContent = \"BokehJS is loading...\";\n",
       "    },\n",
       "    function(Bokeh) {\n",
       "      console.log(\"Bokeh: injecting CSS: https://cdn.pydata.org/bokeh/release/bokeh-0.12.7.min.css\");\n",
       "      Bokeh.embed.inject_css(\"https://cdn.pydata.org/bokeh/release/bokeh-0.12.7.min.css\");\n",
       "      console.log(\"Bokeh: injecting CSS: https://cdn.pydata.org/bokeh/release/bokeh-widgets-0.12.7.min.css\");\n",
       "      Bokeh.embed.inject_css(\"https://cdn.pydata.org/bokeh/release/bokeh-widgets-0.12.7.min.css\");\n",
       "      console.log(\"Bokeh: injecting CSS: https://cdn.pydata.org/bokeh/release/bokeh-tables-0.12.7.min.css\");\n",
       "      Bokeh.embed.inject_css(\"https://cdn.pydata.org/bokeh/release/bokeh-tables-0.12.7.min.css\");\n",
       "    }\n",
       "  ];\n",
       "\n",
       "  function run_inline_js() {\n",
       "    \n",
       "    if ((root.Bokeh !== undefined) || (force === true)) {\n",
       "      for (var i = 0; i < inline_js.length; i++) {\n",
       "        inline_js[i].call(root, root.Bokeh);\n",
       "      }if (force === true) {\n",
       "        display_loaded();\n",
       "      }} else if (Date.now() < root._bokeh_timeout) {\n",
       "      setTimeout(run_inline_js, 100);\n",
       "    } else if (!root._bokeh_failed_load) {\n",
       "      console.log(\"Bokeh: BokehJS failed to load within specified timeout.\");\n",
       "      root._bokeh_failed_load = true;\n",
       "    } else if (force !== true) {\n",
       "      var cell = $(document.getElementById(\"d2b97aa0-a5b3-4c4d-bf03-4b97d6c642d6\")).parents('.cell').data().cell;\n",
       "      cell.output_area.append_execute_result(NB_LOAD_WARNING)\n",
       "    }\n",
       "\n",
       "  }\n",
       "\n",
       "  if (root._bokeh_is_loading === 0) {\n",
       "    console.log(\"Bokeh: BokehJS loaded, going straight to plotting\");\n",
       "    run_inline_js();\n",
       "  } else {\n",
       "    load_libs(js_urls, function() {\n",
       "      console.log(\"Bokeh: BokehJS plotting callback run at\", now());\n",
       "      run_inline_js();\n",
       "    });\n",
       "  }\n",
       "}(window));"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/html": [
       "\n",
       "\n",
       "    <div class=\"bk-root\">\n",
       "        <div class=\"bk-plotdiv\" id=\"c17de035-4378-4792-a784-37d5f4d73268\"></div>\n",
       "    </div>\n",
       "<script type=\"text/javascript\">\n",
       "  \n",
       "  (function(root) {\n",
       "    function now() {\n",
       "      return new Date();\n",
       "    }\n",
       "  \n",
       "    var force = false;\n",
       "  \n",
       "    if (typeof (root._bokeh_onload_callbacks) === \"undefined\" || force === true) {\n",
       "      root._bokeh_onload_callbacks = [];\n",
       "      root._bokeh_is_loading = undefined;\n",
       "    }\n",
       "  \n",
       "  \n",
       "    \n",
       "    if (typeof (root._bokeh_timeout) === \"undefined\" || force === true) {\n",
       "      root._bokeh_timeout = Date.now() + 0;\n",
       "      root._bokeh_failed_load = false;\n",
       "    }\n",
       "  \n",
       "    var NB_LOAD_WARNING = {'data': {'text/html':\n",
       "       \"<div style='background-color: #fdd'>\\n\"+\n",
       "       \"<p>\\n\"+\n",
       "       \"BokehJS does not appear to have successfully loaded. If loading BokehJS from CDN, this \\n\"+\n",
       "       \"may be due to a slow or bad network connection. Possible fixes:\\n\"+\n",
       "       \"</p>\\n\"+\n",
       "       \"<ul>\\n\"+\n",
       "       \"<li>re-rerun `output_notebook()` to attempt to load from CDN again, or</li>\\n\"+\n",
       "       \"<li>use INLINE resources instead, as so:</li>\\n\"+\n",
       "       \"</ul>\\n\"+\n",
       "       \"<code>\\n\"+\n",
       "       \"from bokeh.resources import INLINE\\n\"+\n",
       "       \"output_notebook(resources=INLINE)\\n\"+\n",
       "       \"</code>\\n\"+\n",
       "       \"</div>\"}};\n",
       "  \n",
       "    function display_loaded() {\n",
       "      if (root.Bokeh !== undefined) {\n",
       "        var el = document.getElementById(\"c17de035-4378-4792-a784-37d5f4d73268\");\n",
       "        if (el != null) {\n",
       "          el.textContent = \"BokehJS \" + Bokeh.version + \" successfully loaded.\";\n",
       "        }\n",
       "      } else if (Date.now() < root._bokeh_timeout) {\n",
       "        setTimeout(display_loaded, 100)\n",
       "      }\n",
       "    }\n",
       "  \n",
       "  \n",
       "    function run_callbacks() {\n",
       "      try {\n",
       "        root._bokeh_onload_callbacks.forEach(function(callback) { callback() });\n",
       "      }\n",
       "      finally {\n",
       "        delete root._bokeh_onload_callbacks\n",
       "      }\n",
       "      console.info(\"Bokeh: all callbacks have finished\");\n",
       "    }\n",
       "  \n",
       "    function load_libs(js_urls, callback) {\n",
       "      root._bokeh_onload_callbacks.push(callback);\n",
       "      if (root._bokeh_is_loading > 0) {\n",
       "        console.log(\"Bokeh: BokehJS is being loaded, scheduling callback at\", now());\n",
       "        return null;\n",
       "      }\n",
       "      if (js_urls == null || js_urls.length === 0) {\n",
       "        run_callbacks();\n",
       "        return null;\n",
       "      }\n",
       "      console.log(\"Bokeh: BokehJS not loaded, scheduling load and callback at\", now());\n",
       "      root._bokeh_is_loading = js_urls.length;\n",
       "      for (var i = 0; i < js_urls.length; i++) {\n",
       "        var url = js_urls[i];\n",
       "        var s = document.createElement('script');\n",
       "        s.src = url;\n",
       "        s.async = false;\n",
       "        s.onreadystatechange = s.onload = function() {\n",
       "          root._bokeh_is_loading--;\n",
       "          if (root._bokeh_is_loading === 0) {\n",
       "            console.log(\"Bokeh: all BokehJS libraries loaded\");\n",
       "            run_callbacks()\n",
       "          }\n",
       "        };\n",
       "        s.onerror = function() {\n",
       "          console.warn(\"failed to load library \" + url);\n",
       "        };\n",
       "        console.log(\"Bokeh: injecting script tag for BokehJS library: \", url);\n",
       "        document.getElementsByTagName(\"head\")[0].appendChild(s);\n",
       "      }\n",
       "    };var element = document.getElementById(\"c17de035-4378-4792-a784-37d5f4d73268\");\n",
       "    if (element == null) {\n",
       "      console.log(\"Bokeh: ERROR: autoload.js configured with elementid 'c17de035-4378-4792-a784-37d5f4d73268' but no matching script tag was found. \")\n",
       "      return false;\n",
       "    }\n",
       "  \n",
       "    var js_urls = [];\n",
       "  \n",
       "    var inline_js = [\n",
       "      function(Bokeh) {\n",
       "        (function() {\n",
       "          var fn = function() {\n",
       "            var docs_json = {\"1aefd650-5492-4151-aae8-b9f93fb29817\":{\"roots\":{\"references\":[{\"attributes\":{\"bottom_units\":\"screen\",\"fill_alpha\":{\"value\":0.5},\"fill_color\":{\"value\":\"lightgrey\"},\"left_units\":\"screen\",\"level\":\"overlay\",\"line_alpha\":{\"value\":1.0},\"line_color\":{\"value\":\"black\"},\"line_dash\":[4,4],\"line_width\":{\"value\":2},\"plot\":null,\"render_mode\":\"css\",\"right_units\":\"screen\",\"top_units\":\"screen\"},\"id\":\"be837774-cc33-421f-acf0-b2817196504b\",\"type\":\"BoxAnnotation\"},{\"attributes\":{\"formatter\":{\"id\":\"3d4ec168-a731-4442-89e6-a8cb6c2a1a5b\",\"type\":\"BasicTickFormatter\"},\"plot\":{\"id\":\"b30bf6a5-1c42-45fd-961d-a9ffdd010901\",\"subtype\":\"Figure\",\"type\":\"Plot\"},\"ticker\":{\"id\":\"15a15848-8448-41a2-aedc-d0d39dbe5409\",\"type\":\"BasicTicker\"}},\"id\":\"5c5c961c-2b45-415f-8e2c-ccc91a666a01\",\"type\":\"LinearAxis\"},{\"attributes\":{},\"id\":\"15a15848-8448-41a2-aedc-d0d39dbe5409\",\"type\":\"BasicTicker\"},{\"attributes\":{},\"id\":\"b9195680-3863-4cd8-938f-825e2ab24665\",\"type\":\"WheelZoomTool\"},{\"attributes\":{},\"id\":\"d7039655-4c5e-4828-9ed4-0601722b7c02\",\"type\":\"SaveTool\"},{\"attributes\":{},\"id\":\"8ecea290-5ff7-4b88-beb6-c6a1b78e2a26\",\"type\":\"BasicTickFormatter\"},{\"attributes\":{\"callback\":null},\"id\":\"7f5e640f-a882-48b2-8a40-5e7d77951ab2\",\"type\":\"DataRange1d\"},{\"attributes\":{},\"id\":\"4d6c579f-463d-4fb1-a498-e995b07cbf50\",\"type\":\"LinearScale\"},{\"attributes\":{\"below\":[{\"id\":\"88e3248e-73dd-4863-af90-62e1430c87c0\",\"type\":\"LinearAxis\"}],\"left\":[{\"id\":\"5c5c961c-2b45-415f-8e2c-ccc91a666a01\",\"type\":\"LinearAxis\"}],\"plot_height\":250,\"plot_width\":250,\"renderers\":[{\"id\":\"88e3248e-73dd-4863-af90-62e1430c87c0\",\"type\":\"LinearAxis\"},{\"id\":\"33993436-97c4-426c-884e-191971909050\",\"type\":\"Grid\"},{\"id\":\"5c5c961c-2b45-415f-8e2c-ccc91a666a01\",\"type\":\"LinearAxis\"},{\"id\":\"1d90fe1b-f176-45c0-a4ab-8716fb36d408\",\"type\":\"Grid\"},{\"id\":\"be837774-cc33-421f-acf0-b2817196504b\",\"type\":\"BoxAnnotation\"},{\"id\":\"aecb9889-0555-44ee-9c14-cc8eae479f71\",\"type\":\"GlyphRenderer\"}],\"title\":{\"id\":\"8c920285-9d37-4bd1-ad21-8b5354013625\",\"type\":\"Title\"},\"toolbar\":{\"id\":\"e2d7f2a3-1aee-4f96-9980-5d38b44451aa\",\"type\":\"Toolbar\"},\"x_range\":{\"id\":\"55819ad3-8d3f-417a-a2c1-6bc4c7016e8c\",\"type\":\"DataRange1d\"},\"x_scale\":{\"id\":\"4d6c579f-463d-4fb1-a498-e995b07cbf50\",\"type\":\"LinearScale\"},\"y_range\":{\"id\":\"7f5e640f-a882-48b2-8a40-5e7d77951ab2\",\"type\":\"DataRange1d\"},\"y_scale\":{\"id\":\"827c8dd6-f9cf-480b-a6ed-acb77c5a2353\",\"type\":\"LinearScale\"}},\"id\":\"b30bf6a5-1c42-45fd-961d-a9ffdd010901\",\"subtype\":\"Figure\",\"type\":\"Plot\"},{\"attributes\":{\"dimension\":1,\"plot\":{\"id\":\"b30bf6a5-1c42-45fd-961d-a9ffdd010901\",\"subtype\":\"Figure\",\"type\":\"Plot\"},\"ticker\":{\"id\":\"15a15848-8448-41a2-aedc-d0d39dbe5409\",\"type\":\"BasicTicker\"}},\"id\":\"1d90fe1b-f176-45c0-a4ab-8716fb36d408\",\"type\":\"Grid\"},{\"attributes\":{},\"id\":\"92e652ac-0fce-479e-a908-1b960c38dd84\",\"type\":\"ResetTool\"},{\"attributes\":{},\"id\":\"864fcd76-5240-4ebb-8cb6-20e7d17363b6\",\"type\":\"PanTool\"},{\"attributes\":{\"formatter\":{\"id\":\"8ecea290-5ff7-4b88-beb6-c6a1b78e2a26\",\"type\":\"BasicTickFormatter\"},\"plot\":{\"id\":\"b30bf6a5-1c42-45fd-961d-a9ffdd010901\",\"subtype\":\"Figure\",\"type\":\"Plot\"},\"ticker\":{\"id\":\"5eebb28e-e4d0-443d-8fde-b74033489023\",\"type\":\"BasicTicker\"}},\"id\":\"88e3248e-73dd-4863-af90-62e1430c87c0\",\"type\":\"LinearAxis\"},{\"attributes\":{\"plot\":{\"id\":\"b30bf6a5-1c42-45fd-961d-a9ffdd010901\",\"subtype\":\"Figure\",\"type\":\"Plot\"},\"ticker\":{\"id\":\"5eebb28e-e4d0-443d-8fde-b74033489023\",\"type\":\"BasicTicker\"}},\"id\":\"33993436-97c4-426c-884e-191971909050\",\"type\":\"Grid\"},{\"attributes\":{},\"id\":\"827c8dd6-f9cf-480b-a6ed-acb77c5a2353\",\"type\":\"LinearScale\"},{\"attributes\":{\"callback\":null,\"column_names\":[\"x\",\"y\"],\"data\":{\"x\":[1,2,3,null,4,5],\"y\":[5,7,2,4,5,8]}},\"id\":\"c62aa5a9-b70b-44a5-8c9a-af5c8babd236\",\"type\":\"ColumnDataSource\"},{\"attributes\":{\"callback\":null},\"id\":\"55819ad3-8d3f-417a-a2c1-6bc4c7016e8c\",\"type\":\"DataRange1d\"},{\"attributes\":{\"active_drag\":\"auto\",\"active_inspect\":\"auto\",\"active_scroll\":\"auto\",\"active_tap\":\"auto\",\"tools\":[{\"id\":\"864fcd76-5240-4ebb-8cb6-20e7d17363b6\",\"type\":\"PanTool\"},{\"id\":\"b9195680-3863-4cd8-938f-825e2ab24665\",\"type\":\"WheelZoomTool\"},{\"id\":\"35a29dea-3e4c-473e-b555-a0789fb17f66\",\"type\":\"BoxZoomTool\"},{\"id\":\"d7039655-4c5e-4828-9ed4-0601722b7c02\",\"type\":\"SaveTool\"},{\"id\":\"92e652ac-0fce-479e-a908-1b960c38dd84\",\"type\":\"ResetTool\"},{\"id\":\"064fbf8a-b283-468c-87be-0f668ea3847b\",\"type\":\"HelpTool\"}]},\"id\":\"e2d7f2a3-1aee-4f96-9980-5d38b44451aa\",\"type\":\"Toolbar\"},{\"attributes\":{\"data_source\":{\"id\":\"c62aa5a9-b70b-44a5-8c9a-af5c8babd236\",\"type\":\"ColumnDataSource\"},\"glyph\":{\"id\":\"38d4ad83-3241-4ec3-8a18-9c7ae9c48242\",\"type\":\"Line\"},\"hover_glyph\":null,\"muted_glyph\":null,\"nonselection_glyph\":{\"id\":\"18426fac-774a-45a9-a704-b9a1908c81eb\",\"type\":\"Line\"},\"selection_glyph\":null,\"view\":{\"id\":\"dec2a8c6-a048-4c52-bdcf-239edd6ffb18\",\"type\":\"CDSView\"}},\"id\":\"aecb9889-0555-44ee-9c14-cc8eae479f71\",\"type\":\"GlyphRenderer\"},{\"attributes\":{\"plot\":null,\"text\":\"\"},\"id\":\"8c920285-9d37-4bd1-ad21-8b5354013625\",\"type\":\"Title\"},{\"attributes\":{\"overlay\":{\"id\":\"be837774-cc33-421f-acf0-b2817196504b\",\"type\":\"BoxAnnotation\"}},\"id\":\"35a29dea-3e4c-473e-b555-a0789fb17f66\",\"type\":\"BoxZoomTool\"},{\"attributes\":{\"line_alpha\":{\"value\":0.1},\"line_color\":{\"value\":\"#1f77b4\"},\"line_width\":{\"value\":2},\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"18426fac-774a-45a9-a704-b9a1908c81eb\",\"type\":\"Line\"},{\"attributes\":{\"line_color\":{\"value\":\"#1f77b4\"},\"line_width\":{\"value\":2},\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"38d4ad83-3241-4ec3-8a18-9c7ae9c48242\",\"type\":\"Line\"},{\"attributes\":{},\"id\":\"3d4ec168-a731-4442-89e6-a8cb6c2a1a5b\",\"type\":\"BasicTickFormatter\"},{\"attributes\":{\"source\":{\"id\":\"c62aa5a9-b70b-44a5-8c9a-af5c8babd236\",\"type\":\"ColumnDataSource\"}},\"id\":\"dec2a8c6-a048-4c52-bdcf-239edd6ffb18\",\"type\":\"CDSView\"},{\"attributes\":{},\"id\":\"064fbf8a-b283-468c-87be-0f668ea3847b\",\"type\":\"HelpTool\"},{\"attributes\":{},\"id\":\"5eebb28e-e4d0-443d-8fde-b74033489023\",\"type\":\"BasicTicker\"}],\"root_ids\":[\"b30bf6a5-1c42-45fd-961d-a9ffdd010901\"]},\"title\":\"Bokeh Application\",\"version\":\"0.12.7\"}};\n",
       "            var render_items = [{\"docid\":\"1aefd650-5492-4151-aae8-b9f93fb29817\",\"elementid\":\"c17de035-4378-4792-a784-37d5f4d73268\",\"modelid\":\"b30bf6a5-1c42-45fd-961d-a9ffdd010901\"}];\n",
       "            \n",
       "            Bokeh.embed.embed_items(docs_json, render_items);\n",
       "          };\n",
       "          if (document.readyState != \"loading\") fn();\n",
       "          else document.addEventListener(\"DOMContentLoaded\", fn);\n",
       "        })();\n",
       "      },\n",
       "      function(Bokeh) {\n",
       "      }\n",
       "    ];\n",
       "  \n",
       "    function run_inline_js() {\n",
       "      \n",
       "      if ((root.Bokeh !== undefined) || (force === true)) {\n",
       "        for (var i = 0; i < inline_js.length; i++) {\n",
       "          inline_js[i].call(root, root.Bokeh);\n",
       "        }if (force === true) {\n",
       "          display_loaded();\n",
       "        }} else if (Date.now() < root._bokeh_timeout) {\n",
       "        setTimeout(run_inline_js, 100);\n",
       "      } else if (!root._bokeh_failed_load) {\n",
       "        console.log(\"Bokeh: BokehJS failed to load within specified timeout.\");\n",
       "        root._bokeh_failed_load = true;\n",
       "      } else if (force !== true) {\n",
       "        var cell = $(document.getElementById(\"c17de035-4378-4792-a784-37d5f4d73268\")).parents('.cell').data().cell;\n",
       "        cell.output_area.append_execute_result(NB_LOAD_WARNING)\n",
       "      }\n",
       "  \n",
       "    }\n",
       "  \n",
       "    if (root._bokeh_is_loading === 0) {\n",
       "      console.log(\"Bokeh: BokehJS loaded, going straight to plotting\");\n",
       "      run_inline_js();\n",
       "    } else {\n",
       "      load_libs(js_urls, function() {\n",
       "        console.log(\"Bokeh: BokehJS plotting callback run at\", now());\n",
       "        run_inline_js();\n",
       "      });\n",
       "    }\n",
       "  }(window));\n",
       "</script>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[1, 2, 3, None, 4, 5] \n",
      " [5, 7, 2, 4, 5, 8]\n"
     ]
    }
   ],
   "source": [
    "#None值可以传递到line和multi_line,数据处理为会0值\n",
    "import numpy as np\n",
    "from bokeh.plotting import figure, output_notebook, show\n",
    "\n",
    "output_notebook()\n",
    "p=figure(plot_width=250, plot_height=250)\n",
    "\n",
    "#add a line rendered with a Nan\n",
    "\n",
    "x0=[1,2,3,None,4,5]\n",
    "y0=[5,7,2,4,5,8]\n",
    "p.line(x=x0,y=y0,line_width=2)\n",
    "\n",
    "show(p)\n",
    "print(x0,\"\\n\",y0)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Bars and Rectangels"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Rectangles"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [],
   "source": [
    "#To draw axis aligned rectangles-quads() by specifying the left, right, top, and bottom positions\n",
    "from bokeh.plotting import figure,show,output_file\n",
    "\n",
    "output_file(\"Output//4_1-rectangles.html\")\n",
    "\n",
    "p=figure(plot_width=400,plot_height=400)\n",
    "p.quad(top=[2,3,4],bottom=[1,2,3],left=[1,2,3],right=[1.2,2.5,3.7],\n",
    "      color=\"#B3DE69\")\n",
    "\n",
    "show(p)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [],
   "source": [
    "#To draw arbitrary rectangles-rect(), width, height, and angle\n",
    "from math import pi\n",
    "from bokeh.plotting import figure,show,output_file\n",
    "\n",
    "output_file('Output//4_1-rectangles_rotated.html')\n",
    "p=figure(plot_width=400,plot_height=400)\n",
    "p.rect(x=[1,2,3],y=[1,2,3],width=0.2,height=40,\n",
    "      color=\"#CAB2D6\",angle=pi/3,height_units=\"screen\")\n",
    "show(p)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Bars"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {},
   "outputs": [],
   "source": [
    "#vbar:x-coordinate, width, and top and bottom endpoints\n",
    "from bokeh.plotting import figure, show, output_file\n",
    "\n",
    "output_file(\"Output//4_1-vbar.html\")\n",
    "p=figure(plot_width=400,plot_height=400)\n",
    "p.vbar(x=[1,2,3],width=0.5,bottom=0,\n",
    "      top=[1.2,2.5,3.7],color=\"firebrick\")\n",
    "\n",
    "show(p)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 56,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "\n",
       "    <div class=\"bk-root\">\n",
       "        <a href=\"https://bokeh.pydata.org\" target=\"_blank\" class=\"bk-logo bk-logo-small bk-logo-notebook\"></a>\n",
       "        <span id=\"ed6d9e39-3f5e-4020-ba3e-384df6d1701f\">Loading BokehJS ...</span>\n",
       "    </div>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "application/javascript": [
       "\n",
       "(function(root) {\n",
       "  function now() {\n",
       "    return new Date();\n",
       "  }\n",
       "\n",
       "  var force = true;\n",
       "\n",
       "  if (typeof (root._bokeh_onload_callbacks) === \"undefined\" || force === true) {\n",
       "    root._bokeh_onload_callbacks = [];\n",
       "    root._bokeh_is_loading = undefined;\n",
       "  }\n",
       "\n",
       "\n",
       "  \n",
       "  if (typeof (root._bokeh_timeout) === \"undefined\" || force === true) {\n",
       "    root._bokeh_timeout = Date.now() + 5000;\n",
       "    root._bokeh_failed_load = false;\n",
       "  }\n",
       "\n",
       "  var NB_LOAD_WARNING = {'data': {'text/html':\n",
       "     \"<div style='background-color: #fdd'>\\n\"+\n",
       "     \"<p>\\n\"+\n",
       "     \"BokehJS does not appear to have successfully loaded. If loading BokehJS from CDN, this \\n\"+\n",
       "     \"may be due to a slow or bad network connection. Possible fixes:\\n\"+\n",
       "     \"</p>\\n\"+\n",
       "     \"<ul>\\n\"+\n",
       "     \"<li>re-rerun `output_notebook()` to attempt to load from CDN again, or</li>\\n\"+\n",
       "     \"<li>use INLINE resources instead, as so:</li>\\n\"+\n",
       "     \"</ul>\\n\"+\n",
       "     \"<code>\\n\"+\n",
       "     \"from bokeh.resources import INLINE\\n\"+\n",
       "     \"output_notebook(resources=INLINE)\\n\"+\n",
       "     \"</code>\\n\"+\n",
       "     \"</div>\"}};\n",
       "\n",
       "  function display_loaded() {\n",
       "    if (root.Bokeh !== undefined) {\n",
       "      var el = document.getElementById(\"ed6d9e39-3f5e-4020-ba3e-384df6d1701f\");\n",
       "      if (el != null) {\n",
       "        el.textContent = \"BokehJS \" + Bokeh.version + \" successfully loaded.\";\n",
       "      }\n",
       "    } else if (Date.now() < root._bokeh_timeout) {\n",
       "      setTimeout(display_loaded, 100)\n",
       "    }\n",
       "  }\n",
       "\n",
       "\n",
       "  function run_callbacks() {\n",
       "    try {\n",
       "      root._bokeh_onload_callbacks.forEach(function(callback) { callback() });\n",
       "    }\n",
       "    finally {\n",
       "      delete root._bokeh_onload_callbacks\n",
       "    }\n",
       "    console.info(\"Bokeh: all callbacks have finished\");\n",
       "  }\n",
       "\n",
       "  function load_libs(js_urls, callback) {\n",
       "    root._bokeh_onload_callbacks.push(callback);\n",
       "    if (root._bokeh_is_loading > 0) {\n",
       "      console.log(\"Bokeh: BokehJS is being loaded, scheduling callback at\", now());\n",
       "      return null;\n",
       "    }\n",
       "    if (js_urls == null || js_urls.length === 0) {\n",
       "      run_callbacks();\n",
       "      return null;\n",
       "    }\n",
       "    console.log(\"Bokeh: BokehJS not loaded, scheduling load and callback at\", now());\n",
       "    root._bokeh_is_loading = js_urls.length;\n",
       "    for (var i = 0; i < js_urls.length; i++) {\n",
       "      var url = js_urls[i];\n",
       "      var s = document.createElement('script');\n",
       "      s.src = url;\n",
       "      s.async = false;\n",
       "      s.onreadystatechange = s.onload = function() {\n",
       "        root._bokeh_is_loading--;\n",
       "        if (root._bokeh_is_loading === 0) {\n",
       "          console.log(\"Bokeh: all BokehJS libraries loaded\");\n",
       "          run_callbacks()\n",
       "        }\n",
       "      };\n",
       "      s.onerror = function() {\n",
       "        console.warn(\"failed to load library \" + url);\n",
       "      };\n",
       "      console.log(\"Bokeh: injecting script tag for BokehJS library: \", url);\n",
       "      document.getElementsByTagName(\"head\")[0].appendChild(s);\n",
       "    }\n",
       "  };var element = document.getElementById(\"ed6d9e39-3f5e-4020-ba3e-384df6d1701f\");\n",
       "  if (element == null) {\n",
       "    console.log(\"Bokeh: ERROR: autoload.js configured with elementid 'ed6d9e39-3f5e-4020-ba3e-384df6d1701f' but no matching script tag was found. \")\n",
       "    return false;\n",
       "  }\n",
       "\n",
       "  var js_urls = [\"https://cdn.pydata.org/bokeh/release/bokeh-0.12.7.min.js\", \"https://cdn.pydata.org/bokeh/release/bokeh-widgets-0.12.7.min.js\", \"https://cdn.pydata.org/bokeh/release/bokeh-tables-0.12.7.min.js\", \"https://cdn.pydata.org/bokeh/release/bokeh-gl-0.12.7.min.js\"];\n",
       "\n",
       "  var inline_js = [\n",
       "    function(Bokeh) {\n",
       "      Bokeh.set_log_level(\"info\");\n",
       "    },\n",
       "    \n",
       "    function(Bokeh) {\n",
       "      \n",
       "    },\n",
       "    \n",
       "    function(Bokeh) {\n",
       "      \n",
       "      document.getElementById(\"ed6d9e39-3f5e-4020-ba3e-384df6d1701f\").textContent = \"BokehJS is loading...\";\n",
       "    },\n",
       "    function(Bokeh) {\n",
       "      console.log(\"Bokeh: injecting CSS: https://cdn.pydata.org/bokeh/release/bokeh-0.12.7.min.css\");\n",
       "      Bokeh.embed.inject_css(\"https://cdn.pydata.org/bokeh/release/bokeh-0.12.7.min.css\");\n",
       "      console.log(\"Bokeh: injecting CSS: https://cdn.pydata.org/bokeh/release/bokeh-widgets-0.12.7.min.css\");\n",
       "      Bokeh.embed.inject_css(\"https://cdn.pydata.org/bokeh/release/bokeh-widgets-0.12.7.min.css\");\n",
       "      console.log(\"Bokeh: injecting CSS: https://cdn.pydata.org/bokeh/release/bokeh-tables-0.12.7.min.css\");\n",
       "      Bokeh.embed.inject_css(\"https://cdn.pydata.org/bokeh/release/bokeh-tables-0.12.7.min.css\");\n",
       "    }\n",
       "  ];\n",
       "\n",
       "  function run_inline_js() {\n",
       "    \n",
       "    if ((root.Bokeh !== undefined) || (force === true)) {\n",
       "      for (var i = 0; i < inline_js.length; i++) {\n",
       "        inline_js[i].call(root, root.Bokeh);\n",
       "      }if (force === true) {\n",
       "        display_loaded();\n",
       "      }} else if (Date.now() < root._bokeh_timeout) {\n",
       "      setTimeout(run_inline_js, 100);\n",
       "    } else if (!root._bokeh_failed_load) {\n",
       "      console.log(\"Bokeh: BokehJS failed to load within specified timeout.\");\n",
       "      root._bokeh_failed_load = true;\n",
       "    } else if (force !== true) {\n",
       "      var cell = $(document.getElementById(\"ed6d9e39-3f5e-4020-ba3e-384df6d1701f\")).parents('.cell').data().cell;\n",
       "      cell.output_area.append_execute_result(NB_LOAD_WARNING)\n",
       "    }\n",
       "\n",
       "  }\n",
       "\n",
       "  if (root._bokeh_is_loading === 0) {\n",
       "    console.log(\"Bokeh: BokehJS loaded, going straight to plotting\");\n",
       "    run_inline_js();\n",
       "  } else {\n",
       "    load_libs(js_urls, function() {\n",
       "      console.log(\"Bokeh: BokehJS plotting callback run at\", now());\n",
       "      run_inline_js();\n",
       "    });\n",
       "  }\n",
       "}(window));"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/html": [
       "\n",
       "\n",
       "    <div class=\"bk-root\">\n",
       "        <div class=\"bk-plotdiv\" id=\"c77e0350-d165-4e71-8813-6a29530e34a1\"></div>\n",
       "    </div>\n",
       "<script type=\"text/javascript\">\n",
       "  \n",
       "  (function(root) {\n",
       "    function now() {\n",
       "      return new Date();\n",
       "    }\n",
       "  \n",
       "    var force = false;\n",
       "  \n",
       "    if (typeof (root._bokeh_onload_callbacks) === \"undefined\" || force === true) {\n",
       "      root._bokeh_onload_callbacks = [];\n",
       "      root._bokeh_is_loading = undefined;\n",
       "    }\n",
       "  \n",
       "  \n",
       "    \n",
       "    if (typeof (root._bokeh_timeout) === \"undefined\" || force === true) {\n",
       "      root._bokeh_timeout = Date.now() + 0;\n",
       "      root._bokeh_failed_load = false;\n",
       "    }\n",
       "  \n",
       "    var NB_LOAD_WARNING = {'data': {'text/html':\n",
       "       \"<div style='background-color: #fdd'>\\n\"+\n",
       "       \"<p>\\n\"+\n",
       "       \"BokehJS does not appear to have successfully loaded. If loading BokehJS from CDN, this \\n\"+\n",
       "       \"may be due to a slow or bad network connection. Possible fixes:\\n\"+\n",
       "       \"</p>\\n\"+\n",
       "       \"<ul>\\n\"+\n",
       "       \"<li>re-rerun `output_notebook()` to attempt to load from CDN again, or</li>\\n\"+\n",
       "       \"<li>use INLINE resources instead, as so:</li>\\n\"+\n",
       "       \"</ul>\\n\"+\n",
       "       \"<code>\\n\"+\n",
       "       \"from bokeh.resources import INLINE\\n\"+\n",
       "       \"output_notebook(resources=INLINE)\\n\"+\n",
       "       \"</code>\\n\"+\n",
       "       \"</div>\"}};\n",
       "  \n",
       "    function display_loaded() {\n",
       "      if (root.Bokeh !== undefined) {\n",
       "        var el = document.getElementById(\"c77e0350-d165-4e71-8813-6a29530e34a1\");\n",
       "        if (el != null) {\n",
       "          el.textContent = \"BokehJS \" + Bokeh.version + \" successfully loaded.\";\n",
       "        }\n",
       "      } else if (Date.now() < root._bokeh_timeout) {\n",
       "        setTimeout(display_loaded, 100)\n",
       "      }\n",
       "    }\n",
       "  \n",
       "  \n",
       "    function run_callbacks() {\n",
       "      try {\n",
       "        root._bokeh_onload_callbacks.forEach(function(callback) { callback() });\n",
       "      }\n",
       "      finally {\n",
       "        delete root._bokeh_onload_callbacks\n",
       "      }\n",
       "      console.info(\"Bokeh: all callbacks have finished\");\n",
       "    }\n",
       "  \n",
       "    function load_libs(js_urls, callback) {\n",
       "      root._bokeh_onload_callbacks.push(callback);\n",
       "      if (root._bokeh_is_loading > 0) {\n",
       "        console.log(\"Bokeh: BokehJS is being loaded, scheduling callback at\", now());\n",
       "        return null;\n",
       "      }\n",
       "      if (js_urls == null || js_urls.length === 0) {\n",
       "        run_callbacks();\n",
       "        return null;\n",
       "      }\n",
       "      console.log(\"Bokeh: BokehJS not loaded, scheduling load and callback at\", now());\n",
       "      root._bokeh_is_loading = js_urls.length;\n",
       "      for (var i = 0; i < js_urls.length; i++) {\n",
       "        var url = js_urls[i];\n",
       "        var s = document.createElement('script');\n",
       "        s.src = url;\n",
       "        s.async = false;\n",
       "        s.onreadystatechange = s.onload = function() {\n",
       "          root._bokeh_is_loading--;\n",
       "          if (root._bokeh_is_loading === 0) {\n",
       "            console.log(\"Bokeh: all BokehJS libraries loaded\");\n",
       "            run_callbacks()\n",
       "          }\n",
       "        };\n",
       "        s.onerror = function() {\n",
       "          console.warn(\"failed to load library \" + url);\n",
       "        };\n",
       "        console.log(\"Bokeh: injecting script tag for BokehJS library: \", url);\n",
       "        document.getElementsByTagName(\"head\")[0].appendChild(s);\n",
       "      }\n",
       "    };var element = document.getElementById(\"c77e0350-d165-4e71-8813-6a29530e34a1\");\n",
       "    if (element == null) {\n",
       "      console.log(\"Bokeh: ERROR: autoload.js configured with elementid 'c77e0350-d165-4e71-8813-6a29530e34a1' but no matching script tag was found. \")\n",
       "      return false;\n",
       "    }\n",
       "  \n",
       "    var js_urls = [];\n",
       "  \n",
       "    var inline_js = [\n",
       "      function(Bokeh) {\n",
       "        (function() {\n",
       "          var fn = function() {\n",
       "            var docs_json = {\"8584c34f-f599-4bcd-8c22-a18477ff75a0\":{\"roots\":{\"references\":[{\"attributes\":{},\"id\":\"43debbfb-d5f7-417e-b51a-51de43609db6\",\"type\":\"BasicTickFormatter\"},{\"attributes\":{},\"id\":\"cc430e94-e2a2-49bf-a075-1660cec041df\",\"type\":\"SaveTool\"},{\"attributes\":{},\"id\":\"005dc27b-c7fd-4e4b-aa79-d9449c179928\",\"type\":\"BasicTickFormatter\"},{\"attributes\":{\"bottom_units\":\"screen\",\"fill_alpha\":{\"value\":0.5},\"fill_color\":{\"value\":\"lightgrey\"},\"left_units\":\"screen\",\"level\":\"overlay\",\"line_alpha\":{\"value\":1.0},\"line_color\":{\"value\":\"black\"},\"line_dash\":[4,4],\"line_width\":{\"value\":2},\"plot\":null,\"render_mode\":\"css\",\"right_units\":\"screen\",\"top_units\":\"screen\"},\"id\":\"6a585bdc-8940-4fbb-8b6e-2bb85bfd98a4\",\"type\":\"BoxAnnotation\"},{\"attributes\":{\"fill_color\":{\"value\":\"firebrick\"},\"line_color\":{\"value\":\"firebrick\"},\"top\":{\"field\":\"top\"},\"width\":{\"value\":0.5},\"x\":{\"field\":\"x\"}},\"id\":\"1ef300be-6059-4bf1-b00e-fceb59d4bdd0\",\"type\":\"VBar\"},{\"attributes\":{\"source\":{\"id\":\"ca85b3ed-256d-4ce2-b575-b354f8e0970f\",\"type\":\"ColumnDataSource\"}},\"id\":\"86648623-093a-4125-aa45-bae701bc5d2b\",\"type\":\"CDSView\"},{\"attributes\":{\"fill_alpha\":{\"value\":0.1},\"fill_color\":{\"value\":\"#1f77b4\"},\"line_alpha\":{\"value\":0.1},\"line_color\":{\"value\":\"#1f77b4\"},\"top\":{\"field\":\"top\"},\"width\":{\"value\":0.5},\"x\":{\"field\":\"x\"}},\"id\":\"055c8468-3f28-433a-b514-dc59ad5ece28\",\"type\":\"VBar\"},{\"attributes\":{\"callback\":null,\"column_names\":[\"x\",\"top\"],\"data\":{\"top\":[1.2,2.5,3.7,4.9],\"x\":[1,2,3,4]}},\"id\":\"88f9ba81-acbb-44c5-a58c-cbbe6ecd88ee\",\"type\":\"ColumnDataSource\"},{\"attributes\":{\"data_source\":{\"id\":\"ca85b3ed-256d-4ce2-b575-b354f8e0970f\",\"type\":\"ColumnDataSource\"},\"glyph\":{\"id\":\"7c9411c1-449e-4a63-9c9d-dccc43c112f6\",\"type\":\"Text\"},\"hover_glyph\":null,\"muted_glyph\":null,\"nonselection_glyph\":{\"id\":\"ed60a8bf-b933-4ab0-b120-1393a4762ee3\",\"type\":\"Text\"},\"selection_glyph\":null,\"view\":{\"id\":\"86648623-093a-4125-aa45-bae701bc5d2b\",\"type\":\"CDSView\"}},\"id\":\"15a2951b-1970-4f53-95b7-99559ddb928d\",\"type\":\"GlyphRenderer\"},{\"attributes\":{\"formatter\":{\"id\":\"43debbfb-d5f7-417e-b51a-51de43609db6\",\"type\":\"BasicTickFormatter\"},\"plot\":{\"id\":\"ce053ea2-5b63-4fc2-8041-7f2c85507a92\",\"subtype\":\"Figure\",\"type\":\"Plot\"},\"ticker\":{\"id\":\"836322b4-a43b-4330-bdcb-04691ec5b93e\",\"type\":\"BasicTicker\"}},\"id\":\"a98092f5-9b67-42ab-9bf9-2f52ed4f0758\",\"type\":\"LinearAxis\"},{\"attributes\":{\"data_source\":{\"id\":\"88f9ba81-acbb-44c5-a58c-cbbe6ecd88ee\",\"type\":\"ColumnDataSource\"},\"glyph\":{\"id\":\"1ef300be-6059-4bf1-b00e-fceb59d4bdd0\",\"type\":\"VBar\"},\"hover_glyph\":null,\"muted_glyph\":null,\"nonselection_glyph\":{\"id\":\"055c8468-3f28-433a-b514-dc59ad5ece28\",\"type\":\"VBar\"},\"selection_glyph\":null,\"view\":{\"id\":\"18575543-dc6a-4f2a-bbb1-534848bd5dee\",\"type\":\"CDSView\"}},\"id\":\"79640f5e-c431-452d-bceb-faedbb0c411f\",\"type\":\"GlyphRenderer\"},{\"attributes\":{\"dimension\":1,\"plot\":{\"id\":\"ce053ea2-5b63-4fc2-8041-7f2c85507a92\",\"subtype\":\"Figure\",\"type\":\"Plot\"},\"ticker\":{\"id\":\"975e7bde-6644-476a-8875-3076b0035d6b\",\"type\":\"BasicTicker\"}},\"id\":\"4c8f999d-1d92-4c66-9c14-915a55caac67\",\"type\":\"Grid\"},{\"attributes\":{\"plot\":null,\"text\":\"\"},\"id\":\"57c91c14-29cd-4015-82bd-11060f82109e\",\"type\":\"Title\"},{\"attributes\":{\"text_align\":\"center\",\"text_baseline\":\"middle\",\"text_color\":{\"value\":\"black\"},\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"7c9411c1-449e-4a63-9c9d-dccc43c112f6\",\"type\":\"Text\"},{\"attributes\":{},\"id\":\"975e7bde-6644-476a-8875-3076b0035d6b\",\"type\":\"BasicTicker\"},{\"attributes\":{},\"id\":\"836322b4-a43b-4330-bdcb-04691ec5b93e\",\"type\":\"BasicTicker\"},{\"attributes\":{},\"id\":\"de67030e-3120-4662-a133-5dbe773ccba8\",\"type\":\"WheelZoomTool\"},{\"attributes\":{\"formatter\":{\"id\":\"005dc27b-c7fd-4e4b-aa79-d9449c179928\",\"type\":\"BasicTickFormatter\"},\"plot\":{\"id\":\"ce053ea2-5b63-4fc2-8041-7f2c85507a92\",\"subtype\":\"Figure\",\"type\":\"Plot\"},\"ticker\":{\"id\":\"975e7bde-6644-476a-8875-3076b0035d6b\",\"type\":\"BasicTicker\"}},\"id\":\"ee80efc1-a0ac-4031-be35-fce358876383\",\"type\":\"LinearAxis\"},{\"attributes\":{\"overlay\":{\"id\":\"6a585bdc-8940-4fbb-8b6e-2bb85bfd98a4\",\"type\":\"BoxAnnotation\"}},\"id\":\"bcde2260-e416-4180-addf-12eee5e80989\",\"type\":\"BoxZoomTool\"},{\"attributes\":{},\"id\":\"bf69b324-595d-4b5f-aa87-1dd541d691a3\",\"type\":\"HelpTool\"},{\"attributes\":{\"callback\":null,\"column_names\":[\"x\",\"y\",\"text\"],\"data\":{\"text\":[\"1.2\",\"2.5\",\"3.7\",\"4.9\"],\"x\":[1,2,3,4],\"y\":[0.6,1.25,1.85,2.45]}},\"id\":\"ca85b3ed-256d-4ce2-b575-b354f8e0970f\",\"type\":\"ColumnDataSource\"},{\"attributes\":{\"callback\":null},\"id\":\"4c274cae-bb64-4f74-a457-9754e18a2f5e\",\"type\":\"DataRange1d\"},{\"attributes\":{\"callback\":null},\"id\":\"6dd8f02c-52b4-4245-b412-0debd6852762\",\"type\":\"DataRange1d\"},{\"attributes\":{},\"id\":\"d68255fd-fec6-440c-b1eb-ad17ab36ca02\",\"type\":\"PanTool\"},{\"attributes\":{\"below\":[{\"id\":\"a98092f5-9b67-42ab-9bf9-2f52ed4f0758\",\"type\":\"LinearAxis\"}],\"left\":[{\"id\":\"ee80efc1-a0ac-4031-be35-fce358876383\",\"type\":\"LinearAxis\"}],\"plot_height\":400,\"plot_width\":400,\"renderers\":[{\"id\":\"a98092f5-9b67-42ab-9bf9-2f52ed4f0758\",\"type\":\"LinearAxis\"},{\"id\":\"3f30a257-7e61-47c5-bbd5-6cdc9c078b02\",\"type\":\"Grid\"},{\"id\":\"ee80efc1-a0ac-4031-be35-fce358876383\",\"type\":\"LinearAxis\"},{\"id\":\"4c8f999d-1d92-4c66-9c14-915a55caac67\",\"type\":\"Grid\"},{\"id\":\"6a585bdc-8940-4fbb-8b6e-2bb85bfd98a4\",\"type\":\"BoxAnnotation\"},{\"id\":\"79640f5e-c431-452d-bceb-faedbb0c411f\",\"type\":\"GlyphRenderer\"},{\"id\":\"15a2951b-1970-4f53-95b7-99559ddb928d\",\"type\":\"GlyphRenderer\"}],\"title\":{\"id\":\"57c91c14-29cd-4015-82bd-11060f82109e\",\"type\":\"Title\"},\"toolbar\":{\"id\":\"2997fad4-13e8-43a1-ac7e-0119eda4b474\",\"type\":\"Toolbar\"},\"x_range\":{\"id\":\"4c274cae-bb64-4f74-a457-9754e18a2f5e\",\"type\":\"DataRange1d\"},\"x_scale\":{\"id\":\"1df0162b-339c-45e9-8cf3-0c34cca0a1d2\",\"type\":\"LinearScale\"},\"y_range\":{\"id\":\"6dd8f02c-52b4-4245-b412-0debd6852762\",\"type\":\"DataRange1d\"},\"y_scale\":{\"id\":\"aa452044-64d7-4dea-a1e0-e26cf8ed6466\",\"type\":\"LinearScale\"}},\"id\":\"ce053ea2-5b63-4fc2-8041-7f2c85507a92\",\"subtype\":\"Figure\",\"type\":\"Plot\"},{\"attributes\":{},\"id\":\"82c651bf-9738-47bc-9c3b-136c149f675a\",\"type\":\"ResetTool\"},{\"attributes\":{\"plot\":{\"id\":\"ce053ea2-5b63-4fc2-8041-7f2c85507a92\",\"subtype\":\"Figure\",\"type\":\"Plot\"},\"ticker\":{\"id\":\"836322b4-a43b-4330-bdcb-04691ec5b93e\",\"type\":\"BasicTicker\"}},\"id\":\"3f30a257-7e61-47c5-bbd5-6cdc9c078b02\",\"type\":\"Grid\"},{\"attributes\":{\"active_drag\":\"auto\",\"active_inspect\":\"auto\",\"active_scroll\":\"auto\",\"active_tap\":\"auto\",\"tools\":[{\"id\":\"d68255fd-fec6-440c-b1eb-ad17ab36ca02\",\"type\":\"PanTool\"},{\"id\":\"de67030e-3120-4662-a133-5dbe773ccba8\",\"type\":\"WheelZoomTool\"},{\"id\":\"bcde2260-e416-4180-addf-12eee5e80989\",\"type\":\"BoxZoomTool\"},{\"id\":\"cc430e94-e2a2-49bf-a075-1660cec041df\",\"type\":\"SaveTool\"},{\"id\":\"82c651bf-9738-47bc-9c3b-136c149f675a\",\"type\":\"ResetTool\"},{\"id\":\"bf69b324-595d-4b5f-aa87-1dd541d691a3\",\"type\":\"HelpTool\"}]},\"id\":\"2997fad4-13e8-43a1-ac7e-0119eda4b474\",\"type\":\"Toolbar\"},{\"attributes\":{\"text_align\":\"center\",\"text_alpha\":{\"value\":0.1},\"text_baseline\":\"middle\",\"text_color\":{\"value\":\"black\"},\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"ed60a8bf-b933-4ab0-b120-1393a4762ee3\",\"type\":\"Text\"},{\"attributes\":{\"source\":{\"id\":\"88f9ba81-acbb-44c5-a58c-cbbe6ecd88ee\",\"type\":\"ColumnDataSource\"}},\"id\":\"18575543-dc6a-4f2a-bbb1-534848bd5dee\",\"type\":\"CDSView\"},{\"attributes\":{},\"id\":\"1df0162b-339c-45e9-8cf3-0c34cca0a1d2\",\"type\":\"LinearScale\"},{\"attributes\":{},\"id\":\"aa452044-64d7-4dea-a1e0-e26cf8ed6466\",\"type\":\"LinearScale\"}],\"root_ids\":[\"ce053ea2-5b63-4fc2-8041-7f2c85507a92\"]},\"title\":\"Bokeh Application\",\"version\":\"0.12.7\"}};\n",
       "            var render_items = [{\"docid\":\"8584c34f-f599-4bcd-8c22-a18477ff75a0\",\"elementid\":\"c77e0350-d165-4e71-8813-6a29530e34a1\",\"modelid\":\"ce053ea2-5b63-4fc2-8041-7f2c85507a92\"}];\n",
       "            \n",
       "            Bokeh.embed.embed_items(docs_json, render_items);\n",
       "          };\n",
       "          if (document.readyState != \"loading\") fn();\n",
       "          else document.addEventListener(\"DOMContentLoaded\", fn);\n",
       "        })();\n",
       "      },\n",
       "      function(Bokeh) {\n",
       "      }\n",
       "    ];\n",
       "  \n",
       "    function run_inline_js() {\n",
       "      \n",
       "      if ((root.Bokeh !== undefined) || (force === true)) {\n",
       "        for (var i = 0; i < inline_js.length; i++) {\n",
       "          inline_js[i].call(root, root.Bokeh);\n",
       "        }if (force === true) {\n",
       "          display_loaded();\n",
       "        }} else if (Date.now() < root._bokeh_timeout) {\n",
       "        setTimeout(run_inline_js, 100);\n",
       "      } else if (!root._bokeh_failed_load) {\n",
       "        console.log(\"Bokeh: BokehJS failed to load within specified timeout.\");\n",
       "        root._bokeh_failed_load = true;\n",
       "      } else if (force !== true) {\n",
       "        var cell = $(document.getElementById(\"c77e0350-d165-4e71-8813-6a29530e34a1\")).parents('.cell').data().cell;\n",
       "        cell.output_area.append_execute_result(NB_LOAD_WARNING)\n",
       "      }\n",
       "  \n",
       "    }\n",
       "  \n",
       "    if (root._bokeh_is_loading === 0) {\n",
       "      console.log(\"Bokeh: BokehJS loaded, going straight to plotting\");\n",
       "      run_inline_js();\n",
       "    } else {\n",
       "      load_libs(js_urls, function() {\n",
       "        console.log(\"Bokeh: BokehJS plotting callback run at\", now());\n",
       "        run_inline_js();\n",
       "      });\n",
       "    }\n",
       "  }(window));\n",
       "</script>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "#vbar+text\n",
    "from bokeh.plotting import figure, show, output_notebook\n",
    "\n",
    "output_notebook()\n",
    "p=figure(plot_width=400,plot_height=400)\n",
    "x0=[1,2,3,4]\n",
    "t0=[1.2,2.5,3.7,4.9]\n",
    "y0=[round(i*0.5,2) for i in list(t0)]\n",
    "\n",
    "p.vbar(x=x0,width=0.5,bottom=0,\n",
    "      top=t0,color=\"firebrick\")\n",
    "p.text(x=x0,y=y0,text=[\"%.1f\" %(y1) for (y1) in zip(t0)],\n",
    "      text_baseline=\"middle\",text_align=\"center\")\n",
    "\n",
    "show(p)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {},
   "outputs": [],
   "source": [
    "#hbar: y-coordinate, height, and left and right endpoints\n",
    "from bokeh.plotting import figure, show, output_file\n",
    "\n",
    "output_file(\"Output//4_1-hbar.html\")\n",
    "p=figure(plot_width=400,plot_height=400)\n",
    "p.hbar(y=[1,2,3],height=0.5,left=[0,1,2],\n",
    "      right=[1.2,2.5,3.7],color=\"navy\")\n",
    "show(p)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Hex Tiles"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 54,
   "metadata": {},
   "outputs": [
    {
     "ename": "ModuleNotFoundError",
     "evalue": "No module named 'bokeh.util.hex'",
     "output_type": "error",
     "traceback": [
      "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m",
      "\u001b[1;31mModuleNotFoundError\u001b[0m                       Traceback (most recent call last)",
      "\u001b[1;32m<ipython-input-54-d845df417cbb>\u001b[0m in \u001b[0;36m<module>\u001b[1;34m()\u001b[0m\n\u001b[0;32m      4\u001b[0m \u001b[1;32mfrom\u001b[0m \u001b[0mbokeh\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mio\u001b[0m \u001b[1;32mimport\u001b[0m \u001b[0moutput_file\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mshow\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m      5\u001b[0m \u001b[1;32mfrom\u001b[0m \u001b[0mbokeh\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mplotting\u001b[0m \u001b[1;32mimport\u001b[0m \u001b[0mfigure\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m----> 6\u001b[1;33m \u001b[1;32mfrom\u001b[0m \u001b[0mbokeh\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mutil\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mhex\u001b[0m \u001b[1;32mimport\u001b[0m \u001b[0maxial_to_cartesian\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m      7\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m      8\u001b[0m \u001b[0moutput_file\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;34m\"hex_coords.html\"\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n",
      "\u001b[1;31mModuleNotFoundError\u001b[0m: No module named 'bokeh.util.hex'"
     ]
    }
   ],
   "source": [
    "#bokeh.util.hex didn't existed in 0.12.7 version\n",
    "import numpy as np\n",
    "\n",
    "from bokeh.io import output_file, show\n",
    "from bokeh.plotting import figure\n",
    "from bokeh.util.hex import axial_to_cartesian\n",
    "\n",
    "output_file(\"Output//4_1-hex_coords.html\")\n",
    "\n",
    "q = np.array([0,  0, 0, -1, -1,  1, 1])\n",
    "r = np.array([0, -1, 1,  0,  1, -1, 0])\n",
    "\n",
    "p = figure(plot_width=400, plot_height=400, toolbar_location=None)\n",
    "p.grid.visible = False\n",
    "\n",
    "p.hex_tile(q, r, size=1, fill_color=[\"firebrick\"]*3 + [\"navy\"]*4,\n",
    "           line_color=\"white\", alpha=0.5)\n",
    "\n",
    "x, y = axial_to_cartesian(q, r, 1, \"pointytop\")\n",
    "p.text(x, y, text=[\"(%d, %d)\" % (q,r) for (q, r) in zip(q, r)],\n",
    "       text_baseline=\"middle\", text_align=\"center\")\n",
    "\n",
    "show(p)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 55,
   "metadata": {},
   "outputs": [
    {
     "ename": "ModuleNotFoundError",
     "evalue": "No module named 'bokeh.util.hex'",
     "output_type": "error",
     "traceback": [
      "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m",
      "\u001b[1;31mModuleNotFoundError\u001b[0m                       Traceback (most recent call last)",
      "\u001b[1;32m<ipython-input-55-34a498397680>\u001b[0m in \u001b[0;36m<module>\u001b[1;34m()\u001b[0m\n\u001b[0;32m      4\u001b[0m \u001b[1;32mfrom\u001b[0m \u001b[0mbokeh\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mplotting\u001b[0m \u001b[1;32mimport\u001b[0m \u001b[0mfigure\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m      5\u001b[0m \u001b[1;32mfrom\u001b[0m \u001b[0mbokeh\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mtransform\u001b[0m \u001b[1;32mimport\u001b[0m \u001b[0mlinear_cmap\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m----> 6\u001b[1;33m \u001b[1;32mfrom\u001b[0m \u001b[0mbokeh\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mutil\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mhex\u001b[0m \u001b[1;32mimport\u001b[0m \u001b[0mhexbin\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m      7\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m      8\u001b[0m \u001b[0mn\u001b[0m \u001b[1;33m=\u001b[0m \u001b[1;36m50000\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n",
      "\u001b[1;31mModuleNotFoundError\u001b[0m: No module named 'bokeh.util.hex'"
     ]
    }
   ],
   "source": [
    "import numpy as np\n",
    "\n",
    "from bokeh.io import output_file, show\n",
    "from bokeh.plotting import figure\n",
    "from bokeh.transform import linear_cmap\n",
    "from bokeh.util.hex import hexbin\n",
    "\n",
    "n = 50000\n",
    "x = np.random.standard_normal(n)\n",
    "y = np.random.standard_normal(n)\n",
    "\n",
    "bins = hexbin(x, y, 0.1)\n",
    "\n",
    "p = figure(tools=\"wheel_zoom,reset\", match_aspect=True, background_fill_color='#440154')\n",
    "p.grid.visible = False\n",
    "\n",
    "p.hex_tile(q=\"q\", r=\"r\", size=0.1, line_color=None, source=bins,\n",
    "           fill_color=linear_cmap('counts', 'Viridis256', 0, max(bins.counts)))\n",
    "\n",
    "output_file(\"Output//4_1-hex_tile.html\")\n",
    "\n",
    "show(p)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Patch Glyphs"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Single Patches"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [],
   "source": [
    "from bokeh.plotting import figure,output_file,show\n",
    "output_file(\"Output//4_1-patch.html\")\n",
    "p=figure(plot_width=400,plot_height=400)\n",
    "# add a patch renderer with an alpha an line width\n",
    "p.patch(x=[1,2,3,4,5],y=[6,7,8,7,3],alpha=0.5,line_width=2)\n",
    "show(p)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Multiple Patches"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [],
   "source": [
    "from bokeh.plotting import figure,output_file,show\n",
    "output_file(\"Output//4_1-patches.html\")\n",
    "p=figure(plot_width=400,plot_height=400)\n",
    "#patches的参数是xs,而不是x\n",
    "p.patcheOutput//4_1s(xs=[[1,3,2],[3,4,6,6]],ys=[[2,1,4],[4,7,8,5]],\n",
    "           color=[\"firebrick\",\"navy\"],alpha=[0.8,0.3],line_width=2)\n",
    "show(p)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Ovals and Ellipses"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Ovals"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 25,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "\n",
       "\n",
       "    <div class=\"bk-root\">\n",
       "        <div class=\"bk-plotdiv\" id=\"dcb582ea-2ea6-425f-8e6e-78ec266de243\"></div>\n",
       "    </div>\n",
       "<script type=\"text/javascript\">\n",
       "  \n",
       "  (function(root) {\n",
       "    function now() {\n",
       "      return new Date();\n",
       "    }\n",
       "  \n",
       "    var force = false;\n",
       "  \n",
       "    if (typeof (root._bokeh_onload_callbacks) === \"undefined\" || force === true) {\n",
       "      root._bokeh_onload_callbacks = [];\n",
       "      root._bokeh_is_loading = undefined;\n",
       "    }\n",
       "  \n",
       "  \n",
       "    \n",
       "    if (typeof (root._bokeh_timeout) === \"undefined\" || force === true) {\n",
       "      root._bokeh_timeout = Date.now() + 0;\n",
       "      root._bokeh_failed_load = false;\n",
       "    }\n",
       "  \n",
       "    var NB_LOAD_WARNING = {'data': {'text/html':\n",
       "       \"<div style='background-color: #fdd'>\\n\"+\n",
       "       \"<p>\\n\"+\n",
       "       \"BokehJS does not appear to have successfully loaded. If loading BokehJS from CDN, this \\n\"+\n",
       "       \"may be due to a slow or bad network connection. Possible fixes:\\n\"+\n",
       "       \"</p>\\n\"+\n",
       "       \"<ul>\\n\"+\n",
       "       \"<li>re-rerun `output_notebook()` to attempt to load from CDN again, or</li>\\n\"+\n",
       "       \"<li>use INLINE resources instead, as so:</li>\\n\"+\n",
       "       \"</ul>\\n\"+\n",
       "       \"<code>\\n\"+\n",
       "       \"from bokeh.resources import INLINE\\n\"+\n",
       "       \"output_notebook(resources=INLINE)\\n\"+\n",
       "       \"</code>\\n\"+\n",
       "       \"</div>\"}};\n",
       "  \n",
       "    function display_loaded() {\n",
       "      if (root.Bokeh !== undefined) {\n",
       "        var el = document.getElementById(\"dcb582ea-2ea6-425f-8e6e-78ec266de243\");\n",
       "        if (el != null) {\n",
       "          el.textContent = \"BokehJS \" + Bokeh.version + \" successfully loaded.\";\n",
       "        }\n",
       "      } else if (Date.now() < root._bokeh_timeout) {\n",
       "        setTimeout(display_loaded, 100)\n",
       "      }\n",
       "    }\n",
       "  \n",
       "  \n",
       "    function run_callbacks() {\n",
       "      try {\n",
       "        root._bokeh_onload_callbacks.forEach(function(callback) { callback() });\n",
       "      }\n",
       "      finally {\n",
       "        delete root._bokeh_onload_callbacks\n",
       "      }\n",
       "      console.info(\"Bokeh: all callbacks have finished\");\n",
       "    }\n",
       "  \n",
       "    function load_libs(js_urls, callback) {\n",
       "      root._bokeh_onload_callbacks.push(callback);\n",
       "      if (root._bokeh_is_loading > 0) {\n",
       "        console.log(\"Bokeh: BokehJS is being loaded, scheduling callback at\", now());\n",
       "        return null;\n",
       "      }\n",
       "      if (js_urls == null || js_urls.length === 0) {\n",
       "        run_callbacks();\n",
       "        return null;\n",
       "      }\n",
       "      console.log(\"Bokeh: BokehJS not loaded, scheduling load and callback at\", now());\n",
       "      root._bokeh_is_loading = js_urls.length;\n",
       "      for (var i = 0; i < js_urls.length; i++) {\n",
       "        var url = js_urls[i];\n",
       "        var s = document.createElement('script');\n",
       "        s.src = url;\n",
       "        s.async = false;\n",
       "        s.onreadystatechange = s.onload = function() {\n",
       "          root._bokeh_is_loading--;\n",
       "          if (root._bokeh_is_loading === 0) {\n",
       "            console.log(\"Bokeh: all BokehJS libraries loaded\");\n",
       "            run_callbacks()\n",
       "          }\n",
       "        };\n",
       "        s.onerror = function() {\n",
       "          console.warn(\"failed to load library \" + url);\n",
       "        };\n",
       "        console.log(\"Bokeh: injecting script tag for BokehJS library: \", url);\n",
       "        document.getElementsByTagName(\"head\")[0].appendChild(s);\n",
       "      }\n",
       "    };var element = document.getElementById(\"dcb582ea-2ea6-425f-8e6e-78ec266de243\");\n",
       "    if (element == null) {\n",
       "      console.log(\"Bokeh: ERROR: autoload.js configured with elementid 'dcb582ea-2ea6-425f-8e6e-78ec266de243' but no matching script tag was found. \")\n",
       "      return false;\n",
       "    }\n",
       "  \n",
       "    var js_urls = [];\n",
       "  \n",
       "    var inline_js = [\n",
       "      function(Bokeh) {\n",
       "        (function() {\n",
       "          var fn = function() {\n",
       "            var docs_json = {\"eb6e6e15-d725-43a4-9d2d-c653c9bce6d2\":{\"roots\":{\"references\":[{\"attributes\":{\"callback\":null,\"column_names\":[\"x\",\"y\"],\"data\":{\"x\":[1,2,3],\"y\":[1,2,3]}},\"id\":\"6fe3d31c-ce3d-4e6c-ad53-e1c6c365dcdd\",\"type\":\"ColumnDataSource\"},{\"attributes\":{},\"id\":\"877445dd-193f-4b7a-a8cd-bfcde703bf0f\",\"type\":\"LinearScale\"},{\"attributes\":{},\"id\":\"5c52a441-eeba-4325-a5b3-941f70c8d9bd\",\"type\":\"LinearScale\"},{\"attributes\":{},\"id\":\"dc8c3c21-00d4-4eab-b8c5-29f83984c91c\",\"type\":\"HelpTool\"},{\"attributes\":{\"bottom_units\":\"screen\",\"fill_alpha\":{\"value\":0.5},\"fill_color\":{\"value\":\"lightgrey\"},\"left_units\":\"screen\",\"level\":\"overlay\",\"line_alpha\":{\"value\":1.0},\"line_color\":{\"value\":\"black\"},\"line_dash\":[4,4],\"line_width\":{\"value\":2},\"plot\":null,\"render_mode\":\"css\",\"right_units\":\"screen\",\"top_units\":\"screen\"},\"id\":\"1f123d62-8d82-43e2-96ac-d5a426f174cc\",\"type\":\"BoxAnnotation\"},{\"attributes\":{\"formatter\":{\"id\":\"027bc63e-916f-48c1-b128-7a592af2d9bf\",\"type\":\"BasicTickFormatter\"},\"plot\":{\"id\":\"6ffbb01c-6257-46a9-90c5-0b1e227aadd6\",\"subtype\":\"Figure\",\"type\":\"Plot\"},\"ticker\":{\"id\":\"e2a01c40-081f-44a8-833f-902d84328a86\",\"type\":\"BasicTicker\"}},\"id\":\"835227e9-9fab-49d5-803b-ef0b76c9fb8b\",\"type\":\"LinearAxis\"},{\"attributes\":{\"plot\":{\"id\":\"6ffbb01c-6257-46a9-90c5-0b1e227aadd6\",\"subtype\":\"Figure\",\"type\":\"Plot\"},\"ticker\":{\"id\":\"e2a01c40-081f-44a8-833f-902d84328a86\",\"type\":\"BasicTicker\"}},\"id\":\"0553533f-102c-447c-a1a1-1f09f57dc46b\",\"type\":\"Grid\"},{\"attributes\":{\"callback\":null},\"id\":\"e3f087af-b862-43d4-93ea-71a4872ac511\",\"type\":\"DataRange1d\"},{\"attributes\":{\"source\":{\"id\":\"6fe3d31c-ce3d-4e6c-ad53-e1c6c365dcdd\",\"type\":\"ColumnDataSource\"}},\"id\":\"a3cd13b2-3492-44b2-99cd-a3e9a2dd9159\",\"type\":\"CDSView\"},{\"attributes\":{\"overlay\":{\"id\":\"1f123d62-8d82-43e2-96ac-d5a426f174cc\",\"type\":\"BoxAnnotation\"}},\"id\":\"e7d41398-0ae4-42d8-a5e6-070f117581ff\",\"type\":\"BoxZoomTool\"},{\"attributes\":{\"active_drag\":\"auto\",\"active_inspect\":\"auto\",\"active_scroll\":\"auto\",\"active_tap\":\"auto\",\"tools\":[{\"id\":\"4a1eff22-fd52-43f7-88ca-bbccf254f214\",\"type\":\"PanTool\"},{\"id\":\"998d81aa-3fb3-44d6-b288-e7f314fe2088\",\"type\":\"WheelZoomTool\"},{\"id\":\"e7d41398-0ae4-42d8-a5e6-070f117581ff\",\"type\":\"BoxZoomTool\"},{\"id\":\"0ca493d3-f671-4bd8-b149-4977a86b4cfc\",\"type\":\"SaveTool\"},{\"id\":\"5beb292f-7cd4-488c-ab71-43678c6233b1\",\"type\":\"ResetTool\"},{\"id\":\"dc8c3c21-00d4-4eab-b8c5-29f83984c91c\",\"type\":\"HelpTool\"}]},\"id\":\"4db04036-edfd-42b2-a08b-c90779633ad1\",\"type\":\"Toolbar\"},{\"attributes\":{\"data_source\":{\"id\":\"6fe3d31c-ce3d-4e6c-ad53-e1c6c365dcdd\",\"type\":\"ColumnDataSource\"},\"glyph\":{\"id\":\"63b8a4ec-c88d-4c1b-b349-b2f79b92413f\",\"type\":\"Oval\"},\"hover_glyph\":null,\"muted_glyph\":null,\"nonselection_glyph\":{\"id\":\"945282d4-f590-4c2b-a6b1-1f4275e70f2c\",\"type\":\"Oval\"},\"selection_glyph\":null,\"view\":{\"id\":\"a3cd13b2-3492-44b2-99cd-a3e9a2dd9159\",\"type\":\"CDSView\"}},\"id\":\"38d0eead-02ff-4314-b479-fd3b0ac11d96\",\"type\":\"GlyphRenderer\"},{\"attributes\":{\"angle\":{\"units\":\"rad\",\"value\":1.0471975511965976},\"fill_alpha\":{\"value\":0.1},\"fill_color\":{\"value\":\"#1f77b4\"},\"height\":{\"units\":\"screen\",\"value\":40},\"line_alpha\":{\"value\":0.1},\"line_color\":{\"value\":\"#1f77b4\"},\"width\":{\"units\":\"data\",\"value\":0.2},\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"945282d4-f590-4c2b-a6b1-1f4275e70f2c\",\"type\":\"Oval\"},{\"attributes\":{},\"id\":\"4a1eff22-fd52-43f7-88ca-bbccf254f214\",\"type\":\"PanTool\"},{\"attributes\":{},\"id\":\"2e8e2257-9f49-44af-8ed4-d71c2c95ce48\",\"type\":\"BasicTickFormatter\"},{\"attributes\":{\"below\":[{\"id\":\"835227e9-9fab-49d5-803b-ef0b76c9fb8b\",\"type\":\"LinearAxis\"}],\"left\":[{\"id\":\"80e6ab9b-93ad-422c-bdf2-9409ae5f3713\",\"type\":\"LinearAxis\"}],\"plot_height\":400,\"plot_width\":400,\"renderers\":[{\"id\":\"835227e9-9fab-49d5-803b-ef0b76c9fb8b\",\"type\":\"LinearAxis\"},{\"id\":\"0553533f-102c-447c-a1a1-1f09f57dc46b\",\"type\":\"Grid\"},{\"id\":\"80e6ab9b-93ad-422c-bdf2-9409ae5f3713\",\"type\":\"LinearAxis\"},{\"id\":\"847fe619-3a2f-474c-befe-91a7c87c7935\",\"type\":\"Grid\"},{\"id\":\"1f123d62-8d82-43e2-96ac-d5a426f174cc\",\"type\":\"BoxAnnotation\"},{\"id\":\"38d0eead-02ff-4314-b479-fd3b0ac11d96\",\"type\":\"GlyphRenderer\"}],\"title\":{\"id\":\"45a259a3-ed75-476f-9cba-869259e76384\",\"type\":\"Title\"},\"toolbar\":{\"id\":\"4db04036-edfd-42b2-a08b-c90779633ad1\",\"type\":\"Toolbar\"},\"x_range\":{\"id\":\"e3f087af-b862-43d4-93ea-71a4872ac511\",\"type\":\"DataRange1d\"},\"x_scale\":{\"id\":\"5c52a441-eeba-4325-a5b3-941f70c8d9bd\",\"type\":\"LinearScale\"},\"y_range\":{\"id\":\"2f40b1f9-7697-4311-9633-645ffa5b72f0\",\"type\":\"DataRange1d\"},\"y_scale\":{\"id\":\"877445dd-193f-4b7a-a8cd-bfcde703bf0f\",\"type\":\"LinearScale\"}},\"id\":\"6ffbb01c-6257-46a9-90c5-0b1e227aadd6\",\"subtype\":\"Figure\",\"type\":\"Plot\"},{\"attributes\":{},\"id\":\"998d81aa-3fb3-44d6-b288-e7f314fe2088\",\"type\":\"WheelZoomTool\"},{\"attributes\":{},\"id\":\"e2a01c40-081f-44a8-833f-902d84328a86\",\"type\":\"BasicTicker\"},{\"attributes\":{\"formatter\":{\"id\":\"2e8e2257-9f49-44af-8ed4-d71c2c95ce48\",\"type\":\"BasicTickFormatter\"},\"plot\":{\"id\":\"6ffbb01c-6257-46a9-90c5-0b1e227aadd6\",\"subtype\":\"Figure\",\"type\":\"Plot\"},\"ticker\":{\"id\":\"61b4f741-0003-44c0-a160-203315911981\",\"type\":\"BasicTicker\"}},\"id\":\"80e6ab9b-93ad-422c-bdf2-9409ae5f3713\",\"type\":\"LinearAxis\"},{\"attributes\":{\"dimension\":1,\"plot\":{\"id\":\"6ffbb01c-6257-46a9-90c5-0b1e227aadd6\",\"subtype\":\"Figure\",\"type\":\"Plot\"},\"ticker\":{\"id\":\"61b4f741-0003-44c0-a160-203315911981\",\"type\":\"BasicTicker\"}},\"id\":\"847fe619-3a2f-474c-befe-91a7c87c7935\",\"type\":\"Grid\"},{\"attributes\":{\"plot\":null,\"text\":\"\"},\"id\":\"45a259a3-ed75-476f-9cba-869259e76384\",\"type\":\"Title\"},{\"attributes\":{},\"id\":\"61b4f741-0003-44c0-a160-203315911981\",\"type\":\"BasicTicker\"},{\"attributes\":{\"angle\":{\"units\":\"rad\",\"value\":1.0471975511965976},\"fill_color\":{\"value\":\"#CAB2D6\"},\"height\":{\"units\":\"screen\",\"value\":40},\"line_color\":{\"value\":\"#CAB2D6\"},\"width\":{\"units\":\"data\",\"value\":0.2},\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"63b8a4ec-c88d-4c1b-b349-b2f79b92413f\",\"type\":\"Oval\"},{\"attributes\":{},\"id\":\"0ca493d3-f671-4bd8-b149-4977a86b4cfc\",\"type\":\"SaveTool\"},{\"attributes\":{},\"id\":\"027bc63e-916f-48c1-b128-7a592af2d9bf\",\"type\":\"BasicTickFormatter\"},{\"attributes\":{},\"id\":\"5beb292f-7cd4-488c-ab71-43678c6233b1\",\"type\":\"ResetTool\"},{\"attributes\":{\"callback\":null},\"id\":\"2f40b1f9-7697-4311-9633-645ffa5b72f0\",\"type\":\"DataRange1d\"}],\"root_ids\":[\"6ffbb01c-6257-46a9-90c5-0b1e227aadd6\"]},\"title\":\"Bokeh Application\",\"version\":\"0.12.7\"}};\n",
       "            var render_items = [{\"docid\":\"eb6e6e15-d725-43a4-9d2d-c653c9bce6d2\",\"elementid\":\"dcb582ea-2ea6-425f-8e6e-78ec266de243\",\"modelid\":\"6ffbb01c-6257-46a9-90c5-0b1e227aadd6\"}];\n",
       "            \n",
       "            Bokeh.embed.embed_items(docs_json, render_items);\n",
       "          };\n",
       "          if (document.readyState != \"loading\") fn();\n",
       "          else document.addEventListener(\"DOMContentLoaded\", fn);\n",
       "        })();\n",
       "      },\n",
       "      function(Bokeh) {\n",
       "      }\n",
       "    ];\n",
       "  \n",
       "    function run_inline_js() {\n",
       "      \n",
       "      if ((root.Bokeh !== undefined) || (force === true)) {\n",
       "        for (var i = 0; i < inline_js.length; i++) {\n",
       "          inline_js[i].call(root, root.Bokeh);\n",
       "        }if (force === true) {\n",
       "          display_loaded();\n",
       "        }} else if (Date.now() < root._bokeh_timeout) {\n",
       "        setTimeout(run_inline_js, 100);\n",
       "      } else if (!root._bokeh_failed_load) {\n",
       "        console.log(\"Bokeh: BokehJS failed to load within specified timeout.\");\n",
       "        root._bokeh_failed_load = true;\n",
       "      } else if (force !== true) {\n",
       "        var cell = $(document.getElementById(\"dcb582ea-2ea6-425f-8e6e-78ec266de243\")).parents('.cell').data().cell;\n",
       "        cell.output_area.append_execute_result(NB_LOAD_WARNING)\n",
       "      }\n",
       "  \n",
       "    }\n",
       "  \n",
       "    if (root._bokeh_is_loading === 0) {\n",
       "      console.log(\"Bokeh: BokehJS loaded, going straight to plotting\");\n",
       "      run_inline_js();\n",
       "    } else {\n",
       "      load_libs(js_urls, function() {\n",
       "        console.log(\"Bokeh: BokehJS plotting callback run at\", now());\n",
       "        run_inline_js();\n",
       "      });\n",
       "    }\n",
       "  }(window));\n",
       "</script>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "from math import pi\n",
    "from bokeh.plotting import figure,show,output_file\n",
    "\n",
    "output_file(\"Output//4_1-ovals.html\")\n",
    "p=figure(plot_width=400,plot_height=400)\n",
    "p.oval(x=[1,2,3],y=[1,2,3],width=0.2,height=40,color=\"#CAB2D6\",\n",
    "      angle=pi/3,height_units=\"screen\")\n",
    "show(p)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Images"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 38,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "\n",
       "\n",
       "    <div class=\"bk-root\">\n",
       "        <div class=\"bk-plotdiv\" id=\"b72063c8-6cde-477b-9a69-29b1996868dd\"></div>\n",
       "    </div>\n",
       "<script type=\"text/javascript\">\n",
       "  \n",
       "  (function(root) {\n",
       "    function now() {\n",
       "      return new Date();\n",
       "    }\n",
       "  \n",
       "    var force = false;\n",
       "  \n",
       "    if (typeof (root._bokeh_onload_callbacks) === \"undefined\" || force === true) {\n",
       "      root._bokeh_onload_callbacks = [];\n",
       "      root._bokeh_is_loading = undefined;\n",
       "    }\n",
       "  \n",
       "  \n",
       "    \n",
       "    if (typeof (root._bokeh_timeout) === \"undefined\" || force === true) {\n",
       "      root._bokeh_timeout = Date.now() + 0;\n",
       "      root._bokeh_failed_load = false;\n",
       "    }\n",
       "  \n",
       "    var NB_LOAD_WARNING = {'data': {'text/html':\n",
       "       \"<div style='background-color: #fdd'>\\n\"+\n",
       "       \"<p>\\n\"+\n",
       "       \"BokehJS does not appear to have successfully loaded. If loading BokehJS from CDN, this \\n\"+\n",
       "       \"may be due to a slow or bad network connection. Possible fixes:\\n\"+\n",
       "       \"</p>\\n\"+\n",
       "       \"<ul>\\n\"+\n",
       "       \"<li>re-rerun `output_notebook()` to attempt to load from CDN again, or</li>\\n\"+\n",
       "       \"<li>use INLINE resources instead, as so:</li>\\n\"+\n",
       "       \"</ul>\\n\"+\n",
       "       \"<code>\\n\"+\n",
       "       \"from bokeh.resources import INLINE\\n\"+\n",
       "       \"output_notebook(resources=INLINE)\\n\"+\n",
       "       \"</code>\\n\"+\n",
       "       \"</div>\"}};\n",
       "  \n",
       "    function display_loaded() {\n",
       "      if (root.Bokeh !== undefined) {\n",
       "        var el = document.getElementById(\"b72063c8-6cde-477b-9a69-29b1996868dd\");\n",
       "        if (el != null) {\n",
       "          el.textContent = \"BokehJS \" + Bokeh.version + \" successfully loaded.\";\n",
       "        }\n",
       "      } else if (Date.now() < root._bokeh_timeout) {\n",
       "        setTimeout(display_loaded, 100)\n",
       "      }\n",
       "    }\n",
       "  \n",
       "  \n",
       "    function run_callbacks() {\n",
       "      try {\n",
       "        root._bokeh_onload_callbacks.forEach(function(callback) { callback() });\n",
       "      }\n",
       "      finally {\n",
       "        delete root._bokeh_onload_callbacks\n",
       "      }\n",
       "      console.info(\"Bokeh: all callbacks have finished\");\n",
       "    }\n",
       "  \n",
       "    function load_libs(js_urls, callback) {\n",
       "      root._bokeh_onload_callbacks.push(callback);\n",
       "      if (root._bokeh_is_loading > 0) {\n",
       "        console.log(\"Bokeh: BokehJS is being loaded, scheduling callback at\", now());\n",
       "        return null;\n",
       "      }\n",
       "      if (js_urls == null || js_urls.length === 0) {\n",
       "        run_callbacks();\n",
       "        return null;\n",
       "      }\n",
       "      console.log(\"Bokeh: BokehJS not loaded, scheduling load and callback at\", now());\n",
       "      root._bokeh_is_loading = js_urls.length;\n",
       "      for (var i = 0; i < js_urls.length; i++) {\n",
       "        var url = js_urls[i];\n",
       "        var s = document.createElement('script');\n",
       "        s.src = url;\n",
       "        s.async = false;\n",
       "        s.onreadystatechange = s.onload = function() {\n",
       "          root._bokeh_is_loading--;\n",
       "          if (root._bokeh_is_loading === 0) {\n",
       "            console.log(\"Bokeh: all BokehJS libraries loaded\");\n",
       "            run_callbacks()\n",
       "          }\n",
       "        };\n",
       "        s.onerror = function() {\n",
       "          console.warn(\"failed to load library \" + url);\n",
       "        };\n",
       "        console.log(\"Bokeh: injecting script tag for BokehJS library: \", url);\n",
       "        document.getElementsByTagName(\"head\")[0].appendChild(s);\n",
       "      }\n",
       "    };var element = document.getElementById(\"b72063c8-6cde-477b-9a69-29b1996868dd\");\n",
       "    if (element == null) {\n",
       "      console.log(\"Bokeh: ERROR: autoload.js configured with elementid 'b72063c8-6cde-477b-9a69-29b1996868dd' but no matching script tag was found. \")\n",
       "      return false;\n",
       "    }\n",
       "  \n",
       "    var js_urls = [];\n",
       "  \n",
       "    var inline_js = [\n",
       "      function(Bokeh) {\n",
       "        (function() {\n",
       "          var fn = function() {\n",
       "            var docs_json = {\"45406405-9f3c-4ef3-a119-4215e9829034\":{\"roots\":{\"references\":[{\"attributes\":{\"dimension\":1,\"plot\":{\"id\":\"efa4139c-ea96-4e49-89ca-9f3921000b71\",\"subtype\":\"Figure\",\"type\":\"Plot\"},\"ticker\":{\"id\":\"c49d5864-644f-46dc-9557-a6d0eab40d85\",\"type\":\"BasicTicker\"}},\"id\":\"4ac38eeb-b270-4607-b152-2f232a3920a2\",\"type\":\"Grid\"},{\"attributes\":{\"bottom_units\":\"screen\",\"fill_alpha\":{\"value\":0.5},\"fill_color\":{\"value\":\"lightgrey\"},\"left_units\":\"screen\",\"level\":\"overlay\",\"line_alpha\":{\"value\":1.0},\"line_color\":{\"value\":\"black\"},\"line_dash\":[4,4],\"line_width\":{\"value\":2},\"plot\":null,\"render_mode\":\"css\",\"right_units\":\"screen\",\"top_units\":\"screen\"},\"id\":\"fbb1b7f4-98d4-477a-b038-7c3f0f477be3\",\"type\":\"BoxAnnotation\"},{\"attributes\":{},\"id\":\"c49d5864-644f-46dc-9557-a6d0eab40d85\",\"type\":\"BasicTicker\"},{\"attributes\":{\"data_source\":{\"id\":\"406bbeb4-625d-46e4-97e5-c3caeb23e8f1\",\"type\":\"ColumnDataSource\"},\"glyph\":{\"id\":\"cbb8e276-0145-4fde-9607-ae12014bcb95\",\"type\":\"ImageRGBA\"},\"hover_glyph\":null,\"muted_glyph\":null,\"nonselection_glyph\":{\"id\":\"9d3753e9-0f77-4921-9b05-c32bb7de0080\",\"type\":\"ImageRGBA\"},\"selection_glyph\":null,\"view\":{\"id\":\"26a0fca1-7f9f-4771-b2a4-9647ab18fcfd\",\"type\":\"CDSView\"}},\"id\":\"d4a74eb5-a6b0-4744-80fe-572e2103a1a8\",\"type\":\"GlyphRenderer\"},{\"attributes\":{\"source\":{\"id\":\"406bbeb4-625d-46e4-97e5-c3caeb23e8f1\",\"type\":\"ColumnDataSource\"}},\"id\":\"26a0fca1-7f9f-4771-b2a4-9647ab18fcfd\",\"type\":\"CDSView\"},{\"attributes\":{},\"id\":\"6fd3829e-da6e-4a61-b9fd-3585e125e80f\",\"type\":\"PanTool\"},{\"attributes\":{\"plot\":null,\"text\":\"\"},\"id\":\"4f1330c6-33c0-459c-8fa7-db419b249c15\",\"type\":\"Title\"},{\"attributes\":{\"plot\":{\"id\":\"efa4139c-ea96-4e49-89ca-9f3921000b71\",\"subtype\":\"Figure\",\"type\":\"Plot\"},\"ticker\":{\"id\":\"39ba7e67-9346-43bc-b5cf-f62bd1c369b2\",\"type\":\"BasicTicker\"}},\"id\":\"0ae85397-39ce-4e6a-a5cf-060218150b27\",\"type\":\"Grid\"},{\"attributes\":{},\"id\":\"2bb8bc96-47bf-4653-8ed9-e1d1b384930b\",\"type\":\"BasicTickFormatter\"},{\"attributes\":{},\"id\":\"f1c2f15c-e42e-4bb7-9584-52976130641a\",\"type\":\"WheelZoomTool\"},{\"attributes\":{},\"id\":\"54f33a19-b2e7-4bc5-8e29-b0f6044a8422\",\"type\":\"SaveTool\"},{\"attributes\":{\"formatter\":{\"id\":\"2bb8bc96-47bf-4653-8ed9-e1d1b384930b\",\"type\":\"BasicTickFormatter\"},\"plot\":{\"id\":\"efa4139c-ea96-4e49-89ca-9f3921000b71\",\"subtype\":\"Figure\",\"type\":\"Plot\"},\"ticker\":{\"id\":\"39ba7e67-9346-43bc-b5cf-f62bd1c369b2\",\"type\":\"BasicTicker\"}},\"id\":\"0d627783-43a2-4a33-a386-6fa471cf7cda\",\"type\":\"LinearAxis\"},{\"attributes\":{\"callback\":null,\"column_names\":[\"image\",\"x\",\"y\",\"dw\",\"dh\"],\"data\":{\"dh\":[10],\"dw\":[10],\"image\":[{\"__ndarray__\":\"AJ4A/wCeDP8Anhn/AJ4m/wCeM/8Anj//AJ5M/wCeWf8Anmb/AJ5y/wCef/8Anoz/AJ6Z/wCepf8AnrL/AJ6//wCezP8Antj/AJ7l/wCe8v8MngD/DJ4M/wyeGf8Mnib/DJ4z/wyeP/8Mnkz/DJ5Z/wyeZv8MnnL/DJ5//wyejP8Mnpn/DJ6l/wyesv8Mnr//DJ7M/wye2P8MnuX/DJ7y/xmeAP8Zngz/GZ4Z/xmeJv8ZnjP/GZ4//xmeTP8Znln/GZ5m/xmecv8Znn//GZ6M/xmemf8ZnqX/GZ6y/xmev/8Znsz/GZ7Y/xme5f8ZnvL/Jp4A/yaeDP8mnhn/Jp4m/yaeM/8mnj//Jp5M/yaeWf8mnmb/Jp5y/yaef/8mnoz/Jp6Z/yaepf8mnrL/Jp6//yaezP8mntj/Jp7l/yae8v8zngD/M54M/zOeGf8znib/M54z/zOeP/8znkz/M55Z/zOeZv8znnL/M55//zOejP8znpn/M56l/zOesv8znr//M57M/zOe2P8znuX/M57y/z+eAP8/ngz/P54Z/z+eJv8/njP/P54//z+eTP8/nln/P55m/z+ecv8/nn//P56M/z+emf8/nqX/P56y/z+ev/8/nsz/P57Y/z+e5f8/nvL/TJ4A/0yeDP9Mnhn/TJ4m/0yeM/9Mnj//TJ5M/0yeWf9Mnmb/TJ5y/0yef/9Mnoz/TJ6Z/0yepf9MnrL/TJ6//0yezP9Mntj/TJ7l/0ye8v9ZngD/WZ4M/1meGf9Znib/WZ4z/1meP/9Znkz/WZ5Z/1meZv9ZnnL/WZ5//1mejP9Znpn/WZ6l/1mesv9Znr//WZ7M/1me2P9ZnuX/WZ7y/2aeAP9mngz/Zp4Z/2aeJv9mnjP/Zp4//2aeTP9mnln/Zp5m/2aecv9mnn//Zp6M/2aemf9mnqX/Zp6y/2aev/9mnsz/Zp7Y/2ae5f9mnvL/cp4A/3KeDP9ynhn/cp4m/3KeM/9ynj//cp5M/3KeWf9ynmb/cp5y/3Kef/9ynoz/cp6Z/3Kepf9ynrL/cp6//3KezP9yntj/cp7l/3Ke8v9/ngD/f54M/3+eGf9/nib/f54z/3+eP/9/nkz/f55Z/3+eZv9/nnL/f55//3+ejP9/npn/f56l/3+esv9/nr//f57M/3+e2P9/nuX/f57y/4yeAP+Mngz/jJ4Z/4yeJv+MnjP/jJ4//4yeTP+Mnln/jJ5m/4yecv+Mnn//jJ6M/4yemf+MnqX/jJ6y/4yev/+Mnsz/jJ7Y/4ye5f+MnvL/mZ4A/5meDP+Znhn/mZ4m/5meM/+Znj//mZ5M/5meWf+Znmb/mZ5y/5mef/+Znoz/mZ6Z/5mepf+ZnrL/mZ6//5mezP+Zntj/mZ7l/5me8v+lngD/pZ4M/6WeGf+lnib/pZ4z/6WeP/+lnkz/pZ5Z/6WeZv+lnnL/pZ5//6WejP+lnpn/pZ6l/6Wesv+lnr//pZ7M/6We2P+lnuX/pZ7y/7KeAP+yngz/sp4Z/7KeJv+ynjP/sp4//7KeTP+ynln/sp5m/7Kecv+ynn//sp6M/7Kemf+ynqX/sp6y/7Kev/+ynsz/sp7Y/7Ke5f+ynvL/v54A/7+eDP+/nhn/v54m/7+eM/+/nj//v55M/7+eWf+/nmb/v55y/7+ef/+/noz/v56Z/7+epf+/nrL/v56//7+ezP+/ntj/v57l/7+e8v/MngD/zJ4M/8yeGf/Mnib/zJ4z/8yeP//Mnkz/zJ5Z/8yeZv/MnnL/zJ5//8yejP/Mnpn/zJ6l/8yesv/Mnr//zJ7M/8ye2P/MnuX/zJ7y/9ieAP/Yngz/2J4Z/9ieJv/YnjP/2J4//9ieTP/Ynln/2J5m/9iecv/Ynn//2J6M/9iemf/YnqX/2J6y/9iev//Ynsz/2J7Y/9ie5f/YnvL/5Z4A/+WeDP/lnhn/5Z4m/+WeM//lnj//5Z5M/+WeWf/lnmb/5Z5y/+Wef//lnoz/5Z6Z/+Wepf/lnrL/5Z6//+WezP/lntj/5Z7l/+We8v/yngD/8p4M//KeGf/ynib/8p4z//KeP//ynkz/8p5Z//KeZv/ynnL/8p5///KejP/ynpn/8p6l//Kesv/ynr//8p7M//Ke2P/ynuX/8p7y/w==\",\"dtype\":\"uint32\",\"shape\":[20,20]}],\"x\":[0],\"y\":[0]}},\"id\":\"406bbeb4-625d-46e4-97e5-c3caeb23e8f1\",\"type\":\"ColumnDataSource\"},{\"attributes\":{\"callback\":null,\"end\":10},\"id\":\"4d1c19e2-4e8d-4e00-8067-92761799c151\",\"type\":\"Range1d\"},{\"attributes\":{\"callback\":null,\"end\":10},\"id\":\"e10d3e31-6959-460e-8b6e-6fd449d8e8a5\",\"type\":\"Range1d\"},{\"attributes\":{},\"id\":\"d9563698-09e6-484d-ad3c-6f7a27ede383\",\"type\":\"LinearScale\"},{\"attributes\":{\"overlay\":{\"id\":\"fbb1b7f4-98d4-477a-b038-7c3f0f477be3\",\"type\":\"BoxAnnotation\"}},\"id\":\"d7b66e3f-7992-4745-9e1f-6900f2999a4a\",\"type\":\"BoxZoomTool\"},{\"attributes\":{},\"id\":\"449686d6-a226-4e85-9e30-5ca48c1f9522\",\"type\":\"HelpTool\"},{\"attributes\":{\"active_drag\":\"auto\",\"active_inspect\":\"auto\",\"active_scroll\":\"auto\",\"active_tap\":\"auto\",\"tools\":[{\"id\":\"6fd3829e-da6e-4a61-b9fd-3585e125e80f\",\"type\":\"PanTool\"},{\"id\":\"f1c2f15c-e42e-4bb7-9584-52976130641a\",\"type\":\"WheelZoomTool\"},{\"id\":\"d7b66e3f-7992-4745-9e1f-6900f2999a4a\",\"type\":\"BoxZoomTool\"},{\"id\":\"54f33a19-b2e7-4bc5-8e29-b0f6044a8422\",\"type\":\"SaveTool\"},{\"id\":\"5fc2c802-c644-467b-b82d-64e656b6c839\",\"type\":\"ResetTool\"},{\"id\":\"449686d6-a226-4e85-9e30-5ca48c1f9522\",\"type\":\"HelpTool\"}]},\"id\":\"49147df7-627c-4d28-9ca0-6d1bc71de804\",\"type\":\"Toolbar\"},{\"attributes\":{},\"id\":\"5fc2c802-c644-467b-b82d-64e656b6c839\",\"type\":\"ResetTool\"},{\"attributes\":{},\"id\":\"39ba7e67-9346-43bc-b5cf-f62bd1c369b2\",\"type\":\"BasicTicker\"},{\"attributes\":{},\"id\":\"692c0de4-d0aa-4974-9cfa-c253a3e165b2\",\"type\":\"LinearScale\"},{\"attributes\":{\"below\":[{\"id\":\"0d627783-43a2-4a33-a386-6fa471cf7cda\",\"type\":\"LinearAxis\"}],\"left\":[{\"id\":\"29c6a71e-640d-4876-8ff6-09268a96c18f\",\"type\":\"LinearAxis\"}],\"plot_height\":400,\"plot_width\":400,\"renderers\":[{\"id\":\"0d627783-43a2-4a33-a386-6fa471cf7cda\",\"type\":\"LinearAxis\"},{\"id\":\"0ae85397-39ce-4e6a-a5cf-060218150b27\",\"type\":\"Grid\"},{\"id\":\"29c6a71e-640d-4876-8ff6-09268a96c18f\",\"type\":\"LinearAxis\"},{\"id\":\"4ac38eeb-b270-4607-b152-2f232a3920a2\",\"type\":\"Grid\"},{\"id\":\"fbb1b7f4-98d4-477a-b038-7c3f0f477be3\",\"type\":\"BoxAnnotation\"},{\"id\":\"d4a74eb5-a6b0-4744-80fe-572e2103a1a8\",\"type\":\"GlyphRenderer\"}],\"title\":{\"id\":\"4f1330c6-33c0-459c-8fa7-db419b249c15\",\"type\":\"Title\"},\"toolbar\":{\"id\":\"49147df7-627c-4d28-9ca0-6d1bc71de804\",\"type\":\"Toolbar\"},\"x_range\":{\"id\":\"e10d3e31-6959-460e-8b6e-6fd449d8e8a5\",\"type\":\"Range1d\"},\"x_scale\":{\"id\":\"692c0de4-d0aa-4974-9cfa-c253a3e165b2\",\"type\":\"LinearScale\"},\"y_range\":{\"id\":\"4d1c19e2-4e8d-4e00-8067-92761799c151\",\"type\":\"Range1d\"},\"y_scale\":{\"id\":\"d9563698-09e6-484d-ad3c-6f7a27ede383\",\"type\":\"LinearScale\"}},\"id\":\"efa4139c-ea96-4e49-89ca-9f3921000b71\",\"subtype\":\"Figure\",\"type\":\"Plot\"},{\"attributes\":{\"dh\":{\"field\":\"dh\",\"units\":\"data\"},\"dw\":{\"field\":\"dw\",\"units\":\"data\"},\"image\":{\"field\":\"image\"},\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"cbb8e276-0145-4fde-9607-ae12014bcb95\",\"type\":\"ImageRGBA\"},{\"attributes\":{},\"id\":\"1bfa44d0-547a-4314-921a-924d435d9b24\",\"type\":\"BasicTickFormatter\"},{\"attributes\":{\"formatter\":{\"id\":\"1bfa44d0-547a-4314-921a-924d435d9b24\",\"type\":\"BasicTickFormatter\"},\"plot\":{\"id\":\"efa4139c-ea96-4e49-89ca-9f3921000b71\",\"subtype\":\"Figure\",\"type\":\"Plot\"},\"ticker\":{\"id\":\"c49d5864-644f-46dc-9557-a6d0eab40d85\",\"type\":\"BasicTicker\"}},\"id\":\"29c6a71e-640d-4876-8ff6-09268a96c18f\",\"type\":\"LinearAxis\"},{\"attributes\":{\"dh\":{\"field\":\"dh\",\"units\":\"data\"},\"dw\":{\"field\":\"dw\",\"units\":\"data\"},\"image\":{\"field\":\"image\"},\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"9d3753e9-0f77-4921-9b05-c32bb7de0080\",\"type\":\"ImageRGBA\"}],\"root_ids\":[\"efa4139c-ea96-4e49-89ca-9f3921000b71\"]},\"title\":\"Bokeh Application\",\"version\":\"0.12.7\"}};\n",
       "            var render_items = [{\"docid\":\"45406405-9f3c-4ef3-a119-4215e9829034\",\"elementid\":\"b72063c8-6cde-477b-9a69-29b1996868dd\",\"modelid\":\"efa4139c-ea96-4e49-89ca-9f3921000b71\"}];\n",
       "            \n",
       "            Bokeh.embed.embed_items(docs_json, render_items);\n",
       "          };\n",
       "          if (document.readyState != \"loading\") fn();\n",
       "          else document.addEventListener(\"DOMContentLoaded\", fn);\n",
       "        })();\n",
       "      },\n",
       "      function(Bokeh) {\n",
       "      }\n",
       "    ];\n",
       "  \n",
       "    function run_inline_js() {\n",
       "      \n",
       "      if ((root.Bokeh !== undefined) || (force === true)) {\n",
       "        for (var i = 0; i < inline_js.length; i++) {\n",
       "          inline_js[i].call(root, root.Bokeh);\n",
       "        }if (force === true) {\n",
       "          display_loaded();\n",
       "        }} else if (Date.now() < root._bokeh_timeout) {\n",
       "        setTimeout(run_inline_js, 100);\n",
       "      } else if (!root._bokeh_failed_load) {\n",
       "        console.log(\"Bokeh: BokehJS failed to load within specified timeout.\");\n",
       "        root._bokeh_failed_load = true;\n",
       "      } else if (force !== true) {\n",
       "        var cell = $(document.getElementById(\"b72063c8-6cde-477b-9a69-29b1996868dd\")).parents('.cell').data().cell;\n",
       "        cell.output_area.append_execute_result(NB_LOAD_WARNING)\n",
       "      }\n",
       "  \n",
       "    }\n",
       "  \n",
       "    if (root._bokeh_is_loading === 0) {\n",
       "      console.log(\"Bokeh: BokehJS loaded, going straight to plotting\");\n",
       "      run_inline_js();\n",
       "    } else {\n",
       "      load_libs(js_urls, function() {\n",
       "        console.log(\"Bokeh: BokehJS plotting callback run at\", now());\n",
       "        run_inline_js();\n",
       "      });\n",
       "    }\n",
       "  }(window));\n",
       "</script>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "#Display RGBA data\n",
    "from __future__ import division\n",
    "import numpy as np\n",
    "from bokeh.plotting import figure,output_file,show\n",
    "\n",
    "# create an array of RGBA data\n",
    "N=20\n",
    "img=np.empty((N,N),dtype=np.uint32)\n",
    "#将数据从二维数组转成三维数组\n",
    "view=img.view(dtype=np.uint8).reshape((N,N,4))\n",
    "for i in range(N):\n",
    "    for j in range(N):\n",
    "        view[i,j,0]=int(255*i/N)\n",
    "        view[i,j,1]=158\n",
    "        view[i,j,2]=int(255*j/N)\n",
    "        view[i,j,3]=255\n",
    "output_file(\"Output//4_1-image_rgba.html\")\n",
    "p=figure(plot_width=400,plot_height=400,x_range=(0,10),y_range=(0,10))\n",
    "p.image_rgba(image=[img],x=[0],y=[0],dw=[10],dh=[10])\n",
    "show(p)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Segments and Rays"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Segment 分段"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [],
   "source": [
    "from bokeh.plotting import figure,show,output_file\n",
    "output_file(\"Output//4_1-segment.html\")\n",
    "p=figure(plot_width=400,plot_height=400)\n",
    "\n",
    "x0=[1,2,3]\n",
    "y0=[1,2,3]\n",
    "x1=[1.5,2.4,3.1]\n",
    "y1=[1.5,2.5,3.7]\n",
    "\n",
    "p.segment(x0=x0,y0=y0,x1=x1,y1=y1,\n",
    "         color=\"#F4A582\",line_width=3)\n",
    "show(p)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## ray 射线"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "metadata": {},
   "outputs": [],
   "source": [
    "from bokeh.plotting import figure,show,output_file\n",
    "output_file(\"Output//4_1-ray.html\")\n",
    "p=figure(plot_width=400,plot_height=400, x_range=(0,10),y_range=(0,10))\n",
    "\n",
    "p.ray(x=[1,2,3],y=[1,2,3],length=6,angle=[30,45,60],\n",
    "     angle_units=\"deg\",color=\"#FB8072\",line_width=2)\n",
    "show(p)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Wedges and Arcs"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Arc 孤度图形"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 37,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "\n",
       "    <div class=\"bk-root\">\n",
       "        <a href=\"https://bokeh.pydata.org\" target=\"_blank\" class=\"bk-logo bk-logo-small bk-logo-notebook\"></a>\n",
       "        <span id=\"beb8682c-cdfc-4728-a207-1f113195c04d\">Loading BokehJS ...</span>\n",
       "    </div>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "application/javascript": [
       "\n",
       "(function(root) {\n",
       "  function now() {\n",
       "    return new Date();\n",
       "  }\n",
       "\n",
       "  var force = true;\n",
       "\n",
       "  if (typeof (root._bokeh_onload_callbacks) === \"undefined\" || force === true) {\n",
       "    root._bokeh_onload_callbacks = [];\n",
       "    root._bokeh_is_loading = undefined;\n",
       "  }\n",
       "\n",
       "\n",
       "  \n",
       "  if (typeof (root._bokeh_timeout) === \"undefined\" || force === true) {\n",
       "    root._bokeh_timeout = Date.now() + 5000;\n",
       "    root._bokeh_failed_load = false;\n",
       "  }\n",
       "\n",
       "  var NB_LOAD_WARNING = {'data': {'text/html':\n",
       "     \"<div style='background-color: #fdd'>\\n\"+\n",
       "     \"<p>\\n\"+\n",
       "     \"BokehJS does not appear to have successfully loaded. If loading BokehJS from CDN, this \\n\"+\n",
       "     \"may be due to a slow or bad network connection. Possible fixes:\\n\"+\n",
       "     \"</p>\\n\"+\n",
       "     \"<ul>\\n\"+\n",
       "     \"<li>re-rerun `output_notebook()` to attempt to load from CDN again, or</li>\\n\"+\n",
       "     \"<li>use INLINE resources instead, as so:</li>\\n\"+\n",
       "     \"</ul>\\n\"+\n",
       "     \"<code>\\n\"+\n",
       "     \"from bokeh.resources import INLINE\\n\"+\n",
       "     \"output_notebook(resources=INLINE)\\n\"+\n",
       "     \"</code>\\n\"+\n",
       "     \"</div>\"}};\n",
       "\n",
       "  function display_loaded() {\n",
       "    if (root.Bokeh !== undefined) {\n",
       "      var el = document.getElementById(\"beb8682c-cdfc-4728-a207-1f113195c04d\");\n",
       "      if (el != null) {\n",
       "        el.textContent = \"BokehJS \" + Bokeh.version + \" successfully loaded.\";\n",
       "      }\n",
       "    } else if (Date.now() < root._bokeh_timeout) {\n",
       "      setTimeout(display_loaded, 100)\n",
       "    }\n",
       "  }\n",
       "\n",
       "\n",
       "  function run_callbacks() {\n",
       "    try {\n",
       "      root._bokeh_onload_callbacks.forEach(function(callback) { callback() });\n",
       "    }\n",
       "    finally {\n",
       "      delete root._bokeh_onload_callbacks\n",
       "    }\n",
       "    console.info(\"Bokeh: all callbacks have finished\");\n",
       "  }\n",
       "\n",
       "  function load_libs(js_urls, callback) {\n",
       "    root._bokeh_onload_callbacks.push(callback);\n",
       "    if (root._bokeh_is_loading > 0) {\n",
       "      console.log(\"Bokeh: BokehJS is being loaded, scheduling callback at\", now());\n",
       "      return null;\n",
       "    }\n",
       "    if (js_urls == null || js_urls.length === 0) {\n",
       "      run_callbacks();\n",
       "      return null;\n",
       "    }\n",
       "    console.log(\"Bokeh: BokehJS not loaded, scheduling load and callback at\", now());\n",
       "    root._bokeh_is_loading = js_urls.length;\n",
       "    for (var i = 0; i < js_urls.length; i++) {\n",
       "      var url = js_urls[i];\n",
       "      var s = document.createElement('script');\n",
       "      s.src = url;\n",
       "      s.async = false;\n",
       "      s.onreadystatechange = s.onload = function() {\n",
       "        root._bokeh_is_loading--;\n",
       "        if (root._bokeh_is_loading === 0) {\n",
       "          console.log(\"Bokeh: all BokehJS libraries loaded\");\n",
       "          run_callbacks()\n",
       "        }\n",
       "      };\n",
       "      s.onerror = function() {\n",
       "        console.warn(\"failed to load library \" + url);\n",
       "      };\n",
       "      console.log(\"Bokeh: injecting script tag for BokehJS library: \", url);\n",
       "      document.getElementsByTagName(\"head\")[0].appendChild(s);\n",
       "    }\n",
       "  };var element = document.getElementById(\"beb8682c-cdfc-4728-a207-1f113195c04d\");\n",
       "  if (element == null) {\n",
       "    console.log(\"Bokeh: ERROR: autoload.js configured with elementid 'beb8682c-cdfc-4728-a207-1f113195c04d' but no matching script tag was found. \")\n",
       "    return false;\n",
       "  }\n",
       "\n",
       "  var js_urls = [\"https://cdn.pydata.org/bokeh/release/bokeh-0.12.7.min.js\", \"https://cdn.pydata.org/bokeh/release/bokeh-widgets-0.12.7.min.js\", \"https://cdn.pydata.org/bokeh/release/bokeh-tables-0.12.7.min.js\", \"https://cdn.pydata.org/bokeh/release/bokeh-gl-0.12.7.min.js\"];\n",
       "\n",
       "  var inline_js = [\n",
       "    function(Bokeh) {\n",
       "      Bokeh.set_log_level(\"info\");\n",
       "    },\n",
       "    \n",
       "    function(Bokeh) {\n",
       "      \n",
       "    },\n",
       "    \n",
       "    function(Bokeh) {\n",
       "      \n",
       "      document.getElementById(\"beb8682c-cdfc-4728-a207-1f113195c04d\").textContent = \"BokehJS is loading...\";\n",
       "    },\n",
       "    function(Bokeh) {\n",
       "      console.log(\"Bokeh: injecting CSS: https://cdn.pydata.org/bokeh/release/bokeh-0.12.7.min.css\");\n",
       "      Bokeh.embed.inject_css(\"https://cdn.pydata.org/bokeh/release/bokeh-0.12.7.min.css\");\n",
       "      console.log(\"Bokeh: injecting CSS: https://cdn.pydata.org/bokeh/release/bokeh-widgets-0.12.7.min.css\");\n",
       "      Bokeh.embed.inject_css(\"https://cdn.pydata.org/bokeh/release/bokeh-widgets-0.12.7.min.css\");\n",
       "      console.log(\"Bokeh: injecting CSS: https://cdn.pydata.org/bokeh/release/bokeh-tables-0.12.7.min.css\");\n",
       "      Bokeh.embed.inject_css(\"https://cdn.pydata.org/bokeh/release/bokeh-tables-0.12.7.min.css\");\n",
       "    }\n",
       "  ];\n",
       "\n",
       "  function run_inline_js() {\n",
       "    \n",
       "    if ((root.Bokeh !== undefined) || (force === true)) {\n",
       "      for (var i = 0; i < inline_js.length; i++) {\n",
       "        inline_js[i].call(root, root.Bokeh);\n",
       "      }if (force === true) {\n",
       "        display_loaded();\n",
       "      }} else if (Date.now() < root._bokeh_timeout) {\n",
       "      setTimeout(run_inline_js, 100);\n",
       "    } else if (!root._bokeh_failed_load) {\n",
       "      console.log(\"Bokeh: BokehJS failed to load within specified timeout.\");\n",
       "      root._bokeh_failed_load = true;\n",
       "    } else if (force !== true) {\n",
       "      var cell = $(document.getElementById(\"beb8682c-cdfc-4728-a207-1f113195c04d\")).parents('.cell').data().cell;\n",
       "      cell.output_area.append_execute_result(NB_LOAD_WARNING)\n",
       "    }\n",
       "\n",
       "  }\n",
       "\n",
       "  if (root._bokeh_is_loading === 0) {\n",
       "    console.log(\"Bokeh: BokehJS loaded, going straight to plotting\");\n",
       "    run_inline_js();\n",
       "  } else {\n",
       "    load_libs(js_urls, function() {\n",
       "      console.log(\"Bokeh: BokehJS plotting callback run at\", now());\n",
       "      run_inline_js();\n",
       "    });\n",
       "  }\n",
       "}(window));"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/html": [
       "\n",
       "\n",
       "    <div class=\"bk-root\">\n",
       "        <div class=\"bk-plotdiv\" id=\"45f0f7e8-9e39-4af9-9412-b956902d8da0\"></div>\n",
       "    </div>\n",
       "<script type=\"text/javascript\">\n",
       "  \n",
       "  (function(root) {\n",
       "    function now() {\n",
       "      return new Date();\n",
       "    }\n",
       "  \n",
       "    var force = false;\n",
       "  \n",
       "    if (typeof (root._bokeh_onload_callbacks) === \"undefined\" || force === true) {\n",
       "      root._bokeh_onload_callbacks = [];\n",
       "      root._bokeh_is_loading = undefined;\n",
       "    }\n",
       "  \n",
       "  \n",
       "    \n",
       "    if (typeof (root._bokeh_timeout) === \"undefined\" || force === true) {\n",
       "      root._bokeh_timeout = Date.now() + 0;\n",
       "      root._bokeh_failed_load = false;\n",
       "    }\n",
       "  \n",
       "    var NB_LOAD_WARNING = {'data': {'text/html':\n",
       "       \"<div style='background-color: #fdd'>\\n\"+\n",
       "       \"<p>\\n\"+\n",
       "       \"BokehJS does not appear to have successfully loaded. If loading BokehJS from CDN, this \\n\"+\n",
       "       \"may be due to a slow or bad network connection. Possible fixes:\\n\"+\n",
       "       \"</p>\\n\"+\n",
       "       \"<ul>\\n\"+\n",
       "       \"<li>re-rerun `output_notebook()` to attempt to load from CDN again, or</li>\\n\"+\n",
       "       \"<li>use INLINE resources instead, as so:</li>\\n\"+\n",
       "       \"</ul>\\n\"+\n",
       "       \"<code>\\n\"+\n",
       "       \"from bokeh.resources import INLINE\\n\"+\n",
       "       \"output_notebook(resources=INLINE)\\n\"+\n",
       "       \"</code>\\n\"+\n",
       "       \"</div>\"}};\n",
       "  \n",
       "    function display_loaded() {\n",
       "      if (root.Bokeh !== undefined) {\n",
       "        var el = document.getElementById(\"45f0f7e8-9e39-4af9-9412-b956902d8da0\");\n",
       "        if (el != null) {\n",
       "          el.textContent = \"BokehJS \" + Bokeh.version + \" successfully loaded.\";\n",
       "        }\n",
       "      } else if (Date.now() < root._bokeh_timeout) {\n",
       "        setTimeout(display_loaded, 100)\n",
       "      }\n",
       "    }\n",
       "  \n",
       "  \n",
       "    function run_callbacks() {\n",
       "      try {\n",
       "        root._bokeh_onload_callbacks.forEach(function(callback) { callback() });\n",
       "      }\n",
       "      finally {\n",
       "        delete root._bokeh_onload_callbacks\n",
       "      }\n",
       "      console.info(\"Bokeh: all callbacks have finished\");\n",
       "    }\n",
       "  \n",
       "    function load_libs(js_urls, callback) {\n",
       "      root._bokeh_onload_callbacks.push(callback);\n",
       "      if (root._bokeh_is_loading > 0) {\n",
       "        console.log(\"Bokeh: BokehJS is being loaded, scheduling callback at\", now());\n",
       "        return null;\n",
       "      }\n",
       "      if (js_urls == null || js_urls.length === 0) {\n",
       "        run_callbacks();\n",
       "        return null;\n",
       "      }\n",
       "      console.log(\"Bokeh: BokehJS not loaded, scheduling load and callback at\", now());\n",
       "      root._bokeh_is_loading = js_urls.length;\n",
       "      for (var i = 0; i < js_urls.length; i++) {\n",
       "        var url = js_urls[i];\n",
       "        var s = document.createElement('script');\n",
       "        s.src = url;\n",
       "        s.async = false;\n",
       "        s.onreadystatechange = s.onload = function() {\n",
       "          root._bokeh_is_loading--;\n",
       "          if (root._bokeh_is_loading === 0) {\n",
       "            console.log(\"Bokeh: all BokehJS libraries loaded\");\n",
       "            run_callbacks()\n",
       "          }\n",
       "        };\n",
       "        s.onerror = function() {\n",
       "          console.warn(\"failed to load library \" + url);\n",
       "        };\n",
       "        console.log(\"Bokeh: injecting script tag for BokehJS library: \", url);\n",
       "        document.getElementsByTagName(\"head\")[0].appendChild(s);\n",
       "      }\n",
       "    };var element = document.getElementById(\"45f0f7e8-9e39-4af9-9412-b956902d8da0\");\n",
       "    if (element == null) {\n",
       "      console.log(\"Bokeh: ERROR: autoload.js configured with elementid '45f0f7e8-9e39-4af9-9412-b956902d8da0' but no matching script tag was found. \")\n",
       "      return false;\n",
       "    }\n",
       "  \n",
       "    var js_urls = [];\n",
       "  \n",
       "    var inline_js = [\n",
       "      function(Bokeh) {\n",
       "        (function() {\n",
       "          var fn = function() {\n",
       "            var docs_json = {\"e711dd33-7672-446e-9e13-7f1f6ef18aa1\":{\"roots\":{\"references\":[{\"attributes\":{},\"id\":\"aa87c721-75b6-4d32-a1de-57551c8ae792\",\"type\":\"HelpTool\"},{\"attributes\":{\"plot\":{\"id\":\"c704f0c4-f86e-4d75-9f63-bd294db168a8\",\"subtype\":\"Figure\",\"type\":\"Plot\"},\"ticker\":{\"id\":\"2b1cca69-41c2-47c7-b1b7-a02aaa7d46aa\",\"type\":\"BasicTicker\"}},\"id\":\"94119805-c632-4170-b1b4-8352aa06d22f\",\"type\":\"Grid\"},{\"attributes\":{},\"id\":\"df9fbcdf-08c2-4663-ba22-aacce71d4183\",\"type\":\"LinearScale\"},{\"attributes\":{},\"id\":\"4176295f-debb-45c9-8a45-e5fad18f3bd7\",\"type\":\"BasicTicker\"},{\"attributes\":{},\"id\":\"4faea223-190d-4474-93b3-83ad2428503c\",\"type\":\"SaveTool\"},{\"attributes\":{\"end_angle\":{\"field\":\"end_angle\",\"units\":\"rad\"},\"line_color\":{\"value\":\"navy\"},\"radius\":{\"field\":\"radius\",\"units\":\"data\"},\"start_angle\":{\"field\":\"start_angle\",\"units\":\"rad\"},\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"5c869874-0e35-4815-b66f-fe8606405022\",\"type\":\"Arc\"},{\"attributes\":{\"overlay\":{\"id\":\"c84c72aa-2c98-44ab-89cd-9b201c1a3cf6\",\"type\":\"BoxAnnotation\"}},\"id\":\"c9b48332-bd7e-42fd-852f-29ef87421a00\",\"type\":\"BoxZoomTool\"},{\"attributes\":{\"below\":[{\"id\":\"64e463d8-33e2-49ea-834f-63c641fc50d5\",\"type\":\"LinearAxis\"}],\"left\":[{\"id\":\"4f858fb3-80d7-4147-9f76-b3d8d45897b6\",\"type\":\"LinearAxis\"}],\"plot_height\":400,\"plot_width\":400,\"renderers\":[{\"id\":\"64e463d8-33e2-49ea-834f-63c641fc50d5\",\"type\":\"LinearAxis\"},{\"id\":\"94119805-c632-4170-b1b4-8352aa06d22f\",\"type\":\"Grid\"},{\"id\":\"4f858fb3-80d7-4147-9f76-b3d8d45897b6\",\"type\":\"LinearAxis\"},{\"id\":\"1bfb27e9-f129-4b9e-a71c-7dc05e32d485\",\"type\":\"Grid\"},{\"id\":\"c84c72aa-2c98-44ab-89cd-9b201c1a3cf6\",\"type\":\"BoxAnnotation\"},{\"id\":\"e8a5d3e6-a7af-471e-8fdf-adc6872eb05b\",\"type\":\"GlyphRenderer\"}],\"title\":{\"id\":\"4796e7a3-6c68-4e94-8840-af9578d804f6\",\"type\":\"Title\"},\"toolbar\":{\"id\":\"c8ec5d4a-b2f2-4d45-b614-558410a33318\",\"type\":\"Toolbar\"},\"x_range\":{\"id\":\"c1a71181-59e1-43de-be5a-bc56e4871baa\",\"type\":\"Range1d\"},\"x_scale\":{\"id\":\"f6ce247e-ecae-40bc-9180-d55baeef2223\",\"type\":\"LinearScale\"},\"y_range\":{\"id\":\"1d8dd44f-255a-4426-bd0b-ee830ba9b71c\",\"type\":\"Range1d\"},\"y_scale\":{\"id\":\"df9fbcdf-08c2-4663-ba22-aacce71d4183\",\"type\":\"LinearScale\"}},\"id\":\"c704f0c4-f86e-4d75-9f63-bd294db168a8\",\"subtype\":\"Figure\",\"type\":\"Plot\"},{\"attributes\":{},\"id\":\"f37a31d6-80aa-4649-98f5-947ad4a527f5\",\"type\":\"WheelZoomTool\"},{\"attributes\":{\"data_source\":{\"id\":\"1d5985f0-5e06-4854-a2de-f7981a1db55e\",\"type\":\"ColumnDataSource\"},\"glyph\":{\"id\":\"5c869874-0e35-4815-b66f-fe8606405022\",\"type\":\"Arc\"},\"hover_glyph\":null,\"muted_glyph\":null,\"nonselection_glyph\":{\"id\":\"23ba6861-182e-4324-80fa-9183ab99bab1\",\"type\":\"Arc\"},\"selection_glyph\":null,\"view\":{\"id\":\"ffaabc6e-0344-4b3f-877d-dde8c6fd8105\",\"type\":\"CDSView\"}},\"id\":\"e8a5d3e6-a7af-471e-8fdf-adc6872eb05b\",\"type\":\"GlyphRenderer\"},{\"attributes\":{\"dimension\":1,\"plot\":{\"id\":\"c704f0c4-f86e-4d75-9f63-bd294db168a8\",\"subtype\":\"Figure\",\"type\":\"Plot\"},\"ticker\":{\"id\":\"4176295f-debb-45c9-8a45-e5fad18f3bd7\",\"type\":\"BasicTicker\"}},\"id\":\"1bfb27e9-f129-4b9e-a71c-7dc05e32d485\",\"type\":\"Grid\"},{\"attributes\":{},\"id\":\"e3283604-7c5a-4d1e-a385-6f2d14ac710b\",\"type\":\"BasicTickFormatter\"},{\"attributes\":{},\"id\":\"5622b268-dbcc-48d9-a1ab-891aad0ae1f4\",\"type\":\"BasicTickFormatter\"},{\"attributes\":{\"source\":{\"id\":\"1d5985f0-5e06-4854-a2de-f7981a1db55e\",\"type\":\"ColumnDataSource\"}},\"id\":\"ffaabc6e-0344-4b3f-877d-dde8c6fd8105\",\"type\":\"CDSView\"},{\"attributes\":{},\"id\":\"f6ce247e-ecae-40bc-9180-d55baeef2223\",\"type\":\"LinearScale\"},{\"attributes\":{\"formatter\":{\"id\":\"5622b268-dbcc-48d9-a1ab-891aad0ae1f4\",\"type\":\"BasicTickFormatter\"},\"plot\":{\"id\":\"c704f0c4-f86e-4d75-9f63-bd294db168a8\",\"subtype\":\"Figure\",\"type\":\"Plot\"},\"ticker\":{\"id\":\"2b1cca69-41c2-47c7-b1b7-a02aaa7d46aa\",\"type\":\"BasicTicker\"}},\"id\":\"64e463d8-33e2-49ea-834f-63c641fc50d5\",\"type\":\"LinearAxis\"},{\"attributes\":{\"end_angle\":{\"field\":\"end_angle\",\"units\":\"rad\"},\"line_alpha\":{\"value\":0.1},\"line_color\":{\"value\":\"#1f77b4\"},\"radius\":{\"field\":\"radius\",\"units\":\"data\"},\"start_angle\":{\"field\":\"start_angle\",\"units\":\"rad\"},\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"23ba6861-182e-4324-80fa-9183ab99bab1\",\"type\":\"Arc\"},{\"attributes\":{\"callback\":null,\"end\":5},\"id\":\"c1a71181-59e1-43de-be5a-bc56e4871baa\",\"type\":\"Range1d\"},{\"attributes\":{},\"id\":\"d5dc6b5f-1853-4ebc-9cb5-660c212acae3\",\"type\":\"PanTool\"},{\"attributes\":{\"active_drag\":\"auto\",\"active_inspect\":\"auto\",\"active_scroll\":\"auto\",\"active_tap\":\"auto\",\"tools\":[{\"id\":\"d5dc6b5f-1853-4ebc-9cb5-660c212acae3\",\"type\":\"PanTool\"},{\"id\":\"f37a31d6-80aa-4649-98f5-947ad4a527f5\",\"type\":\"WheelZoomTool\"},{\"id\":\"c9b48332-bd7e-42fd-852f-29ef87421a00\",\"type\":\"BoxZoomTool\"},{\"id\":\"4faea223-190d-4474-93b3-83ad2428503c\",\"type\":\"SaveTool\"},{\"id\":\"44c9f019-a702-4d73-9056-9a88e8208620\",\"type\":\"ResetTool\"},{\"id\":\"aa87c721-75b6-4d32-a1de-57551c8ae792\",\"type\":\"HelpTool\"}]},\"id\":\"c8ec5d4a-b2f2-4d45-b614-558410a33318\",\"type\":\"Toolbar\"},{\"attributes\":{},\"id\":\"44c9f019-a702-4d73-9056-9a88e8208620\",\"type\":\"ResetTool\"},{\"attributes\":{\"formatter\":{\"id\":\"e3283604-7c5a-4d1e-a385-6f2d14ac710b\",\"type\":\"BasicTickFormatter\"},\"plot\":{\"id\":\"c704f0c4-f86e-4d75-9f63-bd294db168a8\",\"subtype\":\"Figure\",\"type\":\"Plot\"},\"ticker\":{\"id\":\"4176295f-debb-45c9-8a45-e5fad18f3bd7\",\"type\":\"BasicTicker\"}},\"id\":\"4f858fb3-80d7-4147-9f76-b3d8d45897b6\",\"type\":\"LinearAxis\"},{\"attributes\":{},\"id\":\"2b1cca69-41c2-47c7-b1b7-a02aaa7d46aa\",\"type\":\"BasicTicker\"},{\"attributes\":{\"callback\":null,\"end\":5},\"id\":\"1d8dd44f-255a-4426-bd0b-ee830ba9b71c\",\"type\":\"Range1d\"},{\"attributes\":{\"callback\":null,\"column_names\":[\"x\",\"y\",\"radius\",\"start_angle\",\"end_angle\"],\"data\":{\"end_angle\":[3,3,4.71238898038469],\"radius\":[0.4,0.5,0.6],\"start_angle\":[1.5707963267948966,0,0.4],\"x\":[1,2,3],\"y\":[1,2,3]}},\"id\":\"1d5985f0-5e06-4854-a2de-f7981a1db55e\",\"type\":\"ColumnDataSource\"},{\"attributes\":{\"bottom_units\":\"screen\",\"fill_alpha\":{\"value\":0.5},\"fill_color\":{\"value\":\"lightgrey\"},\"left_units\":\"screen\",\"level\":\"overlay\",\"line_alpha\":{\"value\":1.0},\"line_color\":{\"value\":\"black\"},\"line_dash\":[4,4],\"line_width\":{\"value\":2},\"plot\":null,\"render_mode\":\"css\",\"right_units\":\"screen\",\"top_units\":\"screen\"},\"id\":\"c84c72aa-2c98-44ab-89cd-9b201c1a3cf6\",\"type\":\"BoxAnnotation\"},{\"attributes\":{\"plot\":null,\"text\":\"\"},\"id\":\"4796e7a3-6c68-4e94-8840-af9578d804f6\",\"type\":\"Title\"}],\"root_ids\":[\"c704f0c4-f86e-4d75-9f63-bd294db168a8\"]},\"title\":\"Bokeh Application\",\"version\":\"0.12.7\"}};\n",
       "            var render_items = [{\"docid\":\"e711dd33-7672-446e-9e13-7f1f6ef18aa1\",\"elementid\":\"45f0f7e8-9e39-4af9-9412-b956902d8da0\",\"modelid\":\"c704f0c4-f86e-4d75-9f63-bd294db168a8\"}];\n",
       "            \n",
       "            Bokeh.embed.embed_items(docs_json, render_items);\n",
       "          };\n",
       "          if (document.readyState != \"loading\") fn();\n",
       "          else document.addEventListener(\"DOMContentLoaded\", fn);\n",
       "        })();\n",
       "      },\n",
       "      function(Bokeh) {\n",
       "      }\n",
       "    ];\n",
       "  \n",
       "    function run_inline_js() {\n",
       "      \n",
       "      if ((root.Bokeh !== undefined) || (force === true)) {\n",
       "        for (var i = 0; i < inline_js.length; i++) {\n",
       "          inline_js[i].call(root, root.Bokeh);\n",
       "        }if (force === true) {\n",
       "          display_loaded();\n",
       "        }} else if (Date.now() < root._bokeh_timeout) {\n",
       "        setTimeout(run_inline_js, 100);\n",
       "      } else if (!root._bokeh_failed_load) {\n",
       "        console.log(\"Bokeh: BokehJS failed to load within specified timeout.\");\n",
       "        root._bokeh_failed_load = true;\n",
       "      } else if (force !== true) {\n",
       "        var cell = $(document.getElementById(\"45f0f7e8-9e39-4af9-9412-b956902d8da0\")).parents('.cell').data().cell;\n",
       "        cell.output_area.append_execute_result(NB_LOAD_WARNING)\n",
       "      }\n",
       "  \n",
       "    }\n",
       "  \n",
       "    if (root._bokeh_is_loading === 0) {\n",
       "      console.log(\"Bokeh: BokehJS loaded, going straight to plotting\");\n",
       "      run_inline_js();\n",
       "    } else {\n",
       "      load_libs(js_urls, function() {\n",
       "        console.log(\"Bokeh: BokehJS plotting callback run at\", now());\n",
       "        run_inline_js();\n",
       "      });\n",
       "    }\n",
       "  }(window));\n",
       "</script>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "\n",
    "from bokeh.plotting import figure,show,output_notebook\n",
    "output_notebook()\n",
    "p=figure(plot_width=400,plot_height=400,x_range=(0,5),y_range=(0,5))\n",
    "\n",
    "p.arc(x=[1,2,3],y=[1,2,3],    \n",
    "      radius=[0.4,0.5,0.6],                   #ardius: 半径\n",
    "      start_angle=[radians(90),0,0.4],        #起始角度\n",
    "      end_angle=[3,3,radians(270)],           #结束角度\n",
    "      color=\"navy\")\n",
    "show(p)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## wedge 扇形"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 41,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "\n",
       "    <div class=\"bk-root\">\n",
       "        <a href=\"https://bokeh.pydata.org\" target=\"_blank\" class=\"bk-logo bk-logo-small bk-logo-notebook\"></a>\n",
       "        <span id=\"6ea65d4d-0568-490b-aa95-8173497de671\">Loading BokehJS ...</span>\n",
       "    </div>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "application/javascript": [
       "\n",
       "(function(root) {\n",
       "  function now() {\n",
       "    return new Date();\n",
       "  }\n",
       "\n",
       "  var force = true;\n",
       "\n",
       "  if (typeof (root._bokeh_onload_callbacks) === \"undefined\" || force === true) {\n",
       "    root._bokeh_onload_callbacks = [];\n",
       "    root._bokeh_is_loading = undefined;\n",
       "  }\n",
       "\n",
       "\n",
       "  \n",
       "  if (typeof (root._bokeh_timeout) === \"undefined\" || force === true) {\n",
       "    root._bokeh_timeout = Date.now() + 5000;\n",
       "    root._bokeh_failed_load = false;\n",
       "  }\n",
       "\n",
       "  var NB_LOAD_WARNING = {'data': {'text/html':\n",
       "     \"<div style='background-color: #fdd'>\\n\"+\n",
       "     \"<p>\\n\"+\n",
       "     \"BokehJS does not appear to have successfully loaded. If loading BokehJS from CDN, this \\n\"+\n",
       "     \"may be due to a slow or bad network connection. Possible fixes:\\n\"+\n",
       "     \"</p>\\n\"+\n",
       "     \"<ul>\\n\"+\n",
       "     \"<li>re-rerun `output_notebook()` to attempt to load from CDN again, or</li>\\n\"+\n",
       "     \"<li>use INLINE resources instead, as so:</li>\\n\"+\n",
       "     \"</ul>\\n\"+\n",
       "     \"<code>\\n\"+\n",
       "     \"from bokeh.resources import INLINE\\n\"+\n",
       "     \"output_notebook(resources=INLINE)\\n\"+\n",
       "     \"</code>\\n\"+\n",
       "     \"</div>\"}};\n",
       "\n",
       "  function display_loaded() {\n",
       "    if (root.Bokeh !== undefined) {\n",
       "      var el = document.getElementById(\"6ea65d4d-0568-490b-aa95-8173497de671\");\n",
       "      if (el != null) {\n",
       "        el.textContent = \"BokehJS \" + Bokeh.version + \" successfully loaded.\";\n",
       "      }\n",
       "    } else if (Date.now() < root._bokeh_timeout) {\n",
       "      setTimeout(display_loaded, 100)\n",
       "    }\n",
       "  }\n",
       "\n",
       "\n",
       "  function run_callbacks() {\n",
       "    try {\n",
       "      root._bokeh_onload_callbacks.forEach(function(callback) { callback() });\n",
       "    }\n",
       "    finally {\n",
       "      delete root._bokeh_onload_callbacks\n",
       "    }\n",
       "    console.info(\"Bokeh: all callbacks have finished\");\n",
       "  }\n",
       "\n",
       "  function load_libs(js_urls, callback) {\n",
       "    root._bokeh_onload_callbacks.push(callback);\n",
       "    if (root._bokeh_is_loading > 0) {\n",
       "      console.log(\"Bokeh: BokehJS is being loaded, scheduling callback at\", now());\n",
       "      return null;\n",
       "    }\n",
       "    if (js_urls == null || js_urls.length === 0) {\n",
       "      run_callbacks();\n",
       "      return null;\n",
       "    }\n",
       "    console.log(\"Bokeh: BokehJS not loaded, scheduling load and callback at\", now());\n",
       "    root._bokeh_is_loading = js_urls.length;\n",
       "    for (var i = 0; i < js_urls.length; i++) {\n",
       "      var url = js_urls[i];\n",
       "      var s = document.createElement('script');\n",
       "      s.src = url;\n",
       "      s.async = false;\n",
       "      s.onreadystatechange = s.onload = function() {\n",
       "        root._bokeh_is_loading--;\n",
       "        if (root._bokeh_is_loading === 0) {\n",
       "          console.log(\"Bokeh: all BokehJS libraries loaded\");\n",
       "          run_callbacks()\n",
       "        }\n",
       "      };\n",
       "      s.onerror = function() {\n",
       "        console.warn(\"failed to load library \" + url);\n",
       "      };\n",
       "      console.log(\"Bokeh: injecting script tag for BokehJS library: \", url);\n",
       "      document.getElementsByTagName(\"head\")[0].appendChild(s);\n",
       "    }\n",
       "  };var element = document.getElementById(\"6ea65d4d-0568-490b-aa95-8173497de671\");\n",
       "  if (element == null) {\n",
       "    console.log(\"Bokeh: ERROR: autoload.js configured with elementid '6ea65d4d-0568-490b-aa95-8173497de671' but no matching script tag was found. \")\n",
       "    return false;\n",
       "  }\n",
       "\n",
       "  var js_urls = [\"https://cdn.pydata.org/bokeh/release/bokeh-0.12.7.min.js\", \"https://cdn.pydata.org/bokeh/release/bokeh-widgets-0.12.7.min.js\", \"https://cdn.pydata.org/bokeh/release/bokeh-tables-0.12.7.min.js\", \"https://cdn.pydata.org/bokeh/release/bokeh-gl-0.12.7.min.js\"];\n",
       "\n",
       "  var inline_js = [\n",
       "    function(Bokeh) {\n",
       "      Bokeh.set_log_level(\"info\");\n",
       "    },\n",
       "    \n",
       "    function(Bokeh) {\n",
       "      \n",
       "    },\n",
       "    \n",
       "    function(Bokeh) {\n",
       "      \n",
       "      document.getElementById(\"6ea65d4d-0568-490b-aa95-8173497de671\").textContent = \"BokehJS is loading...\";\n",
       "    },\n",
       "    function(Bokeh) {\n",
       "      console.log(\"Bokeh: injecting CSS: https://cdn.pydata.org/bokeh/release/bokeh-0.12.7.min.css\");\n",
       "      Bokeh.embed.inject_css(\"https://cdn.pydata.org/bokeh/release/bokeh-0.12.7.min.css\");\n",
       "      console.log(\"Bokeh: injecting CSS: https://cdn.pydata.org/bokeh/release/bokeh-widgets-0.12.7.min.css\");\n",
       "      Bokeh.embed.inject_css(\"https://cdn.pydata.org/bokeh/release/bokeh-widgets-0.12.7.min.css\");\n",
       "      console.log(\"Bokeh: injecting CSS: https://cdn.pydata.org/bokeh/release/bokeh-tables-0.12.7.min.css\");\n",
       "      Bokeh.embed.inject_css(\"https://cdn.pydata.org/bokeh/release/bokeh-tables-0.12.7.min.css\");\n",
       "    }\n",
       "  ];\n",
       "\n",
       "  function run_inline_js() {\n",
       "    \n",
       "    if ((root.Bokeh !== undefined) || (force === true)) {\n",
       "      for (var i = 0; i < inline_js.length; i++) {\n",
       "        inline_js[i].call(root, root.Bokeh);\n",
       "      }if (force === true) {\n",
       "        display_loaded();\n",
       "      }} else if (Date.now() < root._bokeh_timeout) {\n",
       "      setTimeout(run_inline_js, 100);\n",
       "    } else if (!root._bokeh_failed_load) {\n",
       "      console.log(\"Bokeh: BokehJS failed to load within specified timeout.\");\n",
       "      root._bokeh_failed_load = true;\n",
       "    } else if (force !== true) {\n",
       "      var cell = $(document.getElementById(\"6ea65d4d-0568-490b-aa95-8173497de671\")).parents('.cell').data().cell;\n",
       "      cell.output_area.append_execute_result(NB_LOAD_WARNING)\n",
       "    }\n",
       "\n",
       "  }\n",
       "\n",
       "  if (root._bokeh_is_loading === 0) {\n",
       "    console.log(\"Bokeh: BokehJS loaded, going straight to plotting\");\n",
       "    run_inline_js();\n",
       "  } else {\n",
       "    load_libs(js_urls, function() {\n",
       "      console.log(\"Bokeh: BokehJS plotting callback run at\", now());\n",
       "      run_inline_js();\n",
       "    });\n",
       "  }\n",
       "}(window));"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/html": [
       "\n",
       "\n",
       "    <div class=\"bk-root\">\n",
       "        <div class=\"bk-plotdiv\" id=\"78bfd04f-34a5-4ac0-84dd-766de7b2dfbd\"></div>\n",
       "    </div>\n",
       "<script type=\"text/javascript\">\n",
       "  \n",
       "  (function(root) {\n",
       "    function now() {\n",
       "      return new Date();\n",
       "    }\n",
       "  \n",
       "    var force = false;\n",
       "  \n",
       "    if (typeof (root._bokeh_onload_callbacks) === \"undefined\" || force === true) {\n",
       "      root._bokeh_onload_callbacks = [];\n",
       "      root._bokeh_is_loading = undefined;\n",
       "    }\n",
       "  \n",
       "  \n",
       "    \n",
       "    if (typeof (root._bokeh_timeout) === \"undefined\" || force === true) {\n",
       "      root._bokeh_timeout = Date.now() + 0;\n",
       "      root._bokeh_failed_load = false;\n",
       "    }\n",
       "  \n",
       "    var NB_LOAD_WARNING = {'data': {'text/html':\n",
       "       \"<div style='background-color: #fdd'>\\n\"+\n",
       "       \"<p>\\n\"+\n",
       "       \"BokehJS does not appear to have successfully loaded. If loading BokehJS from CDN, this \\n\"+\n",
       "       \"may be due to a slow or bad network connection. Possible fixes:\\n\"+\n",
       "       \"</p>\\n\"+\n",
       "       \"<ul>\\n\"+\n",
       "       \"<li>re-rerun `output_notebook()` to attempt to load from CDN again, or</li>\\n\"+\n",
       "       \"<li>use INLINE resources instead, as so:</li>\\n\"+\n",
       "       \"</ul>\\n\"+\n",
       "       \"<code>\\n\"+\n",
       "       \"from bokeh.resources import INLINE\\n\"+\n",
       "       \"output_notebook(resources=INLINE)\\n\"+\n",
       "       \"</code>\\n\"+\n",
       "       \"</div>\"}};\n",
       "  \n",
       "    function display_loaded() {\n",
       "      if (root.Bokeh !== undefined) {\n",
       "        var el = document.getElementById(\"78bfd04f-34a5-4ac0-84dd-766de7b2dfbd\");\n",
       "        if (el != null) {\n",
       "          el.textContent = \"BokehJS \" + Bokeh.version + \" successfully loaded.\";\n",
       "        }\n",
       "      } else if (Date.now() < root._bokeh_timeout) {\n",
       "        setTimeout(display_loaded, 100)\n",
       "      }\n",
       "    }\n",
       "  \n",
       "  \n",
       "    function run_callbacks() {\n",
       "      try {\n",
       "        root._bokeh_onload_callbacks.forEach(function(callback) { callback() });\n",
       "      }\n",
       "      finally {\n",
       "        delete root._bokeh_onload_callbacks\n",
       "      }\n",
       "      console.info(\"Bokeh: all callbacks have finished\");\n",
       "    }\n",
       "  \n",
       "    function load_libs(js_urls, callback) {\n",
       "      root._bokeh_onload_callbacks.push(callback);\n",
       "      if (root._bokeh_is_loading > 0) {\n",
       "        console.log(\"Bokeh: BokehJS is being loaded, scheduling callback at\", now());\n",
       "        return null;\n",
       "      }\n",
       "      if (js_urls == null || js_urls.length === 0) {\n",
       "        run_callbacks();\n",
       "        return null;\n",
       "      }\n",
       "      console.log(\"Bokeh: BokehJS not loaded, scheduling load and callback at\", now());\n",
       "      root._bokeh_is_loading = js_urls.length;\n",
       "      for (var i = 0; i < js_urls.length; i++) {\n",
       "        var url = js_urls[i];\n",
       "        var s = document.createElement('script');\n",
       "        s.src = url;\n",
       "        s.async = false;\n",
       "        s.onreadystatechange = s.onload = function() {\n",
       "          root._bokeh_is_loading--;\n",
       "          if (root._bokeh_is_loading === 0) {\n",
       "            console.log(\"Bokeh: all BokehJS libraries loaded\");\n",
       "            run_callbacks()\n",
       "          }\n",
       "        };\n",
       "        s.onerror = function() {\n",
       "          console.warn(\"failed to load library \" + url);\n",
       "        };\n",
       "        console.log(\"Bokeh: injecting script tag for BokehJS library: \", url);\n",
       "        document.getElementsByTagName(\"head\")[0].appendChild(s);\n",
       "      }\n",
       "    };var element = document.getElementById(\"78bfd04f-34a5-4ac0-84dd-766de7b2dfbd\");\n",
       "    if (element == null) {\n",
       "      console.log(\"Bokeh: ERROR: autoload.js configured with elementid '78bfd04f-34a5-4ac0-84dd-766de7b2dfbd' but no matching script tag was found. \")\n",
       "      return false;\n",
       "    }\n",
       "  \n",
       "    var js_urls = [];\n",
       "  \n",
       "    var inline_js = [\n",
       "      function(Bokeh) {\n",
       "        (function() {\n",
       "          var fn = function() {\n",
       "            var docs_json = {\"52042e7c-adc5-4088-9839-767a1cfd1639\":{\"roots\":{\"references\":[{\"attributes\":{},\"id\":\"ad1e1339-5585-463c-be30-09cfe569816f\",\"type\":\"SaveTool\"},{\"attributes\":{\"bottom_units\":\"screen\",\"fill_alpha\":{\"value\":0.5},\"fill_color\":{\"value\":\"lightgrey\"},\"left_units\":\"screen\",\"level\":\"overlay\",\"line_alpha\":{\"value\":1.0},\"line_color\":{\"value\":\"black\"},\"line_dash\":[4,4],\"line_width\":{\"value\":2},\"plot\":null,\"render_mode\":\"css\",\"right_units\":\"screen\",\"top_units\":\"screen\"},\"id\":\"5d9aaa0f-07b4-4129-b393-48b6bfc1bb47\",\"type\":\"BoxAnnotation\"},{\"attributes\":{\"active_drag\":\"auto\",\"active_inspect\":\"auto\",\"active_scroll\":\"auto\",\"active_tap\":\"auto\",\"tools\":[{\"id\":\"92d94872-d7b1-4622-bb1f-8c1b5a81b4c2\",\"type\":\"PanTool\"},{\"id\":\"57c9205a-63e5-43ee-b3eb-9148ae54504e\",\"type\":\"WheelZoomTool\"},{\"id\":\"5ef74d10-8c71-4e71-91a1-08333819dd45\",\"type\":\"BoxZoomTool\"},{\"id\":\"ad1e1339-5585-463c-be30-09cfe569816f\",\"type\":\"SaveTool\"},{\"id\":\"458ef54e-2991-4657-b12e-d78cbf228046\",\"type\":\"ResetTool\"},{\"id\":\"3eb788ec-604f-463d-a55c-4ad639852b0f\",\"type\":\"HelpTool\"}]},\"id\":\"b4392004-59cd-44a4-827b-5c85482dc546\",\"type\":\"Toolbar\"},{\"attributes\":{},\"id\":\"458ef54e-2991-4657-b12e-d78cbf228046\",\"type\":\"ResetTool\"},{\"attributes\":{},\"id\":\"34a09ad1-f57e-4a8b-8675-6c7700525df3\",\"type\":\"BasicTickFormatter\"},{\"attributes\":{\"direction\":\"clock\",\"end_angle\":{\"field\":\"end_angle\",\"units\":\"rad\"},\"fill_alpha\":{\"value\":0.1},\"fill_color\":{\"value\":\"#1f77b4\"},\"line_alpha\":{\"value\":0.1},\"line_color\":{\"value\":\"#1f77b4\"},\"radius\":{\"units\":\"data\",\"value\":0.2},\"start_angle\":{\"field\":\"start_angle\",\"units\":\"rad\"},\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"d259c99e-c7b0-481c-8c33-8095a705d0df\",\"type\":\"Wedge\"},{\"attributes\":{\"callback\":null},\"id\":\"b202171f-533b-4a48-b33f-169deb41d51c\",\"type\":\"DataRange1d\"},{\"attributes\":{},\"id\":\"2cc145fa-27e9-4aa3-8853-0cf5733a1c7c\",\"type\":\"BasicTickFormatter\"},{\"attributes\":{\"plot\":{\"id\":\"1c6a81ad-a5c1-470e-be31-09e3e045808f\",\"subtype\":\"Figure\",\"type\":\"Plot\"},\"ticker\":{\"id\":\"a5f8ae1c-92a8-470d-a6c3-ee2e10379f93\",\"type\":\"BasicTicker\"}},\"id\":\"34b5527d-1d21-454c-aefc-c187bb3a4dc9\",\"type\":\"Grid\"},{\"attributes\":{},\"id\":\"a333603e-d109-4952-8985-7afa7a968b00\",\"type\":\"LinearScale\"},{\"attributes\":{},\"id\":\"92d94872-d7b1-4622-bb1f-8c1b5a81b4c2\",\"type\":\"PanTool\"},{\"attributes\":{},\"id\":\"57c9205a-63e5-43ee-b3eb-9148ae54504e\",\"type\":\"WheelZoomTool\"},{\"attributes\":{},\"id\":\"a5f8ae1c-92a8-470d-a6c3-ee2e10379f93\",\"type\":\"BasicTicker\"},{\"attributes\":{\"formatter\":{\"id\":\"34a09ad1-f57e-4a8b-8675-6c7700525df3\",\"type\":\"BasicTickFormatter\"},\"plot\":{\"id\":\"1c6a81ad-a5c1-470e-be31-09e3e045808f\",\"subtype\":\"Figure\",\"type\":\"Plot\"},\"ticker\":{\"id\":\"8f3e9ea7-923d-4c22-8aeb-de3a2351fd2d\",\"type\":\"BasicTicker\"}},\"id\":\"486f4bf6-0dce-44a6-bf6f-82c919318458\",\"type\":\"LinearAxis\"},{\"attributes\":{\"callback\":null,\"column_names\":[\"x\",\"y\",\"start_angle\",\"end_angle\",\"fill_color\",\"line_color\"],\"data\":{\"end_angle\":[4.8,4.8,4.71238898038469],\"fill_color\":[\"firebrick\",\"navy\",\"orange\"],\"line_color\":[\"firebrick\",\"navy\",\"orange\"],\"start_angle\":[0.4,0.4,0.7853981633974483],\"x\":[1,2,3],\"y\":[1,2,3]}},\"id\":\"27543f8e-ecca-40ec-a09f-c4b88c4d3872\",\"type\":\"ColumnDataSource\"},{\"attributes\":{\"below\":[{\"id\":\"b1351401-07d8-4fac-8bf3-13f20d972509\",\"type\":\"LinearAxis\"}],\"left\":[{\"id\":\"486f4bf6-0dce-44a6-bf6f-82c919318458\",\"type\":\"LinearAxis\"}],\"plot_height\":400,\"plot_width\":400,\"renderers\":[{\"id\":\"b1351401-07d8-4fac-8bf3-13f20d972509\",\"type\":\"LinearAxis\"},{\"id\":\"34b5527d-1d21-454c-aefc-c187bb3a4dc9\",\"type\":\"Grid\"},{\"id\":\"486f4bf6-0dce-44a6-bf6f-82c919318458\",\"type\":\"LinearAxis\"},{\"id\":\"b332f612-9ac7-4474-91e7-a0d15c3b4324\",\"type\":\"Grid\"},{\"id\":\"5d9aaa0f-07b4-4129-b393-48b6bfc1bb47\",\"type\":\"BoxAnnotation\"},{\"id\":\"817013e6-48b8-4da4-a3d1-aa440d615788\",\"type\":\"GlyphRenderer\"}],\"title\":{\"id\":\"1fa78fb6-638f-4960-a1d4-180e64d27139\",\"type\":\"Title\"},\"toolbar\":{\"id\":\"b4392004-59cd-44a4-827b-5c85482dc546\",\"type\":\"Toolbar\"},\"x_range\":{\"id\":\"ea0c8ad6-04f9-4977-88e4-2bc787309756\",\"type\":\"DataRange1d\"},\"x_scale\":{\"id\":\"a333603e-d109-4952-8985-7afa7a968b00\",\"type\":\"LinearScale\"},\"y_range\":{\"id\":\"b202171f-533b-4a48-b33f-169deb41d51c\",\"type\":\"DataRange1d\"},\"y_scale\":{\"id\":\"3acac48f-d092-4cc7-81d5-d61e67fa61d7\",\"type\":\"LinearScale\"}},\"id\":\"1c6a81ad-a5c1-470e-be31-09e3e045808f\",\"subtype\":\"Figure\",\"type\":\"Plot\"},{\"attributes\":{\"plot\":null,\"text\":\"\"},\"id\":\"1fa78fb6-638f-4960-a1d4-180e64d27139\",\"type\":\"Title\"},{\"attributes\":{\"callback\":null},\"id\":\"ea0c8ad6-04f9-4977-88e4-2bc787309756\",\"type\":\"DataRange1d\"},{\"attributes\":{},\"id\":\"3eb788ec-604f-463d-a55c-4ad639852b0f\",\"type\":\"HelpTool\"},{\"attributes\":{\"dimension\":1,\"plot\":{\"id\":\"1c6a81ad-a5c1-470e-be31-09e3e045808f\",\"subtype\":\"Figure\",\"type\":\"Plot\"},\"ticker\":{\"id\":\"8f3e9ea7-923d-4c22-8aeb-de3a2351fd2d\",\"type\":\"BasicTicker\"}},\"id\":\"b332f612-9ac7-4474-91e7-a0d15c3b4324\",\"type\":\"Grid\"},{\"attributes\":{\"data_source\":{\"id\":\"27543f8e-ecca-40ec-a09f-c4b88c4d3872\",\"type\":\"ColumnDataSource\"},\"glyph\":{\"id\":\"7a88740d-57a4-4dc7-8440-44183026f3a3\",\"type\":\"Wedge\"},\"hover_glyph\":null,\"muted_glyph\":null,\"nonselection_glyph\":{\"id\":\"d259c99e-c7b0-481c-8c33-8095a705d0df\",\"type\":\"Wedge\"},\"selection_glyph\":null,\"view\":{\"id\":\"cb0d30f8-3cdf-455b-bafe-996b442ce053\",\"type\":\"CDSView\"}},\"id\":\"817013e6-48b8-4da4-a3d1-aa440d615788\",\"type\":\"GlyphRenderer\"},{\"attributes\":{\"source\":{\"id\":\"27543f8e-ecca-40ec-a09f-c4b88c4d3872\",\"type\":\"ColumnDataSource\"}},\"id\":\"cb0d30f8-3cdf-455b-bafe-996b442ce053\",\"type\":\"CDSView\"},{\"attributes\":{\"direction\":\"clock\",\"end_angle\":{\"field\":\"end_angle\",\"units\":\"rad\"},\"fill_alpha\":{\"value\":0.6},\"fill_color\":{\"field\":\"fill_color\"},\"line_alpha\":{\"value\":0.6},\"line_color\":{\"field\":\"line_color\"},\"radius\":{\"units\":\"data\",\"value\":0.2},\"start_angle\":{\"field\":\"start_angle\",\"units\":\"rad\"},\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"7a88740d-57a4-4dc7-8440-44183026f3a3\",\"type\":\"Wedge\"},{\"attributes\":{},\"id\":\"8f3e9ea7-923d-4c22-8aeb-de3a2351fd2d\",\"type\":\"BasicTicker\"},{\"attributes\":{},\"id\":\"3acac48f-d092-4cc7-81d5-d61e67fa61d7\",\"type\":\"LinearScale\"},{\"attributes\":{\"formatter\":{\"id\":\"2cc145fa-27e9-4aa3-8853-0cf5733a1c7c\",\"type\":\"BasicTickFormatter\"},\"plot\":{\"id\":\"1c6a81ad-a5c1-470e-be31-09e3e045808f\",\"subtype\":\"Figure\",\"type\":\"Plot\"},\"ticker\":{\"id\":\"a5f8ae1c-92a8-470d-a6c3-ee2e10379f93\",\"type\":\"BasicTicker\"}},\"id\":\"b1351401-07d8-4fac-8bf3-13f20d972509\",\"type\":\"LinearAxis\"},{\"attributes\":{\"overlay\":{\"id\":\"5d9aaa0f-07b4-4129-b393-48b6bfc1bb47\",\"type\":\"BoxAnnotation\"}},\"id\":\"5ef74d10-8c71-4e71-91a1-08333819dd45\",\"type\":\"BoxZoomTool\"}],\"root_ids\":[\"1c6a81ad-a5c1-470e-be31-09e3e045808f\"]},\"title\":\"Bokeh Application\",\"version\":\"0.12.7\"}};\n",
       "            var render_items = [{\"docid\":\"52042e7c-adc5-4088-9839-767a1cfd1639\",\"elementid\":\"78bfd04f-34a5-4ac0-84dd-766de7b2dfbd\",\"modelid\":\"1c6a81ad-a5c1-470e-be31-09e3e045808f\"}];\n",
       "            \n",
       "            Bokeh.embed.embed_items(docs_json, render_items);\n",
       "          };\n",
       "          if (document.readyState != \"loading\") fn();\n",
       "          else document.addEventListener(\"DOMContentLoaded\", fn);\n",
       "        })();\n",
       "      },\n",
       "      function(Bokeh) {\n",
       "      }\n",
       "    ];\n",
       "  \n",
       "    function run_inline_js() {\n",
       "      \n",
       "      if ((root.Bokeh !== undefined) || (force === true)) {\n",
       "        for (var i = 0; i < inline_js.length; i++) {\n",
       "          inline_js[i].call(root, root.Bokeh);\n",
       "        }if (force === true) {\n",
       "          display_loaded();\n",
       "        }} else if (Date.now() < root._bokeh_timeout) {\n",
       "        setTimeout(run_inline_js, 100);\n",
       "      } else if (!root._bokeh_failed_load) {\n",
       "        console.log(\"Bokeh: BokehJS failed to load within specified timeout.\");\n",
       "        root._bokeh_failed_load = true;\n",
       "      } else if (force !== true) {\n",
       "        var cell = $(document.getElementById(\"78bfd04f-34a5-4ac0-84dd-766de7b2dfbd\")).parents('.cell').data().cell;\n",
       "        cell.output_area.append_execute_result(NB_LOAD_WARNING)\n",
       "      }\n",
       "  \n",
       "    }\n",
       "  \n",
       "    if (root._bokeh_is_loading === 0) {\n",
       "      console.log(\"Bokeh: BokehJS loaded, going straight to plotting\");\n",
       "      run_inline_js();\n",
       "    } else {\n",
       "      load_libs(js_urls, function() {\n",
       "        console.log(\"Bokeh: BokehJS plotting callback run at\", now());\n",
       "        run_inline_js();\n",
       "      });\n",
       "    }\n",
       "  }(window));\n",
       "</script>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "#用法和arc相似\n",
    "import math\n",
    "from bokeh.plotting import figure, show,output_notebook\n",
    "output_notebook()\n",
    "\n",
    "p = figure(plot_width=400, plot_height=400)\n",
    "p.wedge(x=[1, 2, 3], y=[1, 2, 3], \n",
    "        radius=0.2, \n",
    "        start_angle=[0.4,0.4,radians(45)], \n",
    "        end_angle=[4.8,4.8,radians(270)],\n",
    "        color=[\"firebrick\",\"navy\",\"orange\"], \n",
    "        alpha=0.6, direction=\"clock\")\n",
    "show(p)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## annulus 环形"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 42,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "\n",
       "    <div class=\"bk-root\">\n",
       "        <a href=\"https://bokeh.pydata.org\" target=\"_blank\" class=\"bk-logo bk-logo-small bk-logo-notebook\"></a>\n",
       "        <span id=\"ad233165-e7b0-4b18-947b-254517c47790\">Loading BokehJS ...</span>\n",
       "    </div>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "application/javascript": [
       "\n",
       "(function(root) {\n",
       "  function now() {\n",
       "    return new Date();\n",
       "  }\n",
       "\n",
       "  var force = true;\n",
       "\n",
       "  if (typeof (root._bokeh_onload_callbacks) === \"undefined\" || force === true) {\n",
       "    root._bokeh_onload_callbacks = [];\n",
       "    root._bokeh_is_loading = undefined;\n",
       "  }\n",
       "\n",
       "\n",
       "  \n",
       "  if (typeof (root._bokeh_timeout) === \"undefined\" || force === true) {\n",
       "    root._bokeh_timeout = Date.now() + 5000;\n",
       "    root._bokeh_failed_load = false;\n",
       "  }\n",
       "\n",
       "  var NB_LOAD_WARNING = {'data': {'text/html':\n",
       "     \"<div style='background-color: #fdd'>\\n\"+\n",
       "     \"<p>\\n\"+\n",
       "     \"BokehJS does not appear to have successfully loaded. If loading BokehJS from CDN, this \\n\"+\n",
       "     \"may be due to a slow or bad network connection. Possible fixes:\\n\"+\n",
       "     \"</p>\\n\"+\n",
       "     \"<ul>\\n\"+\n",
       "     \"<li>re-rerun `output_notebook()` to attempt to load from CDN again, or</li>\\n\"+\n",
       "     \"<li>use INLINE resources instead, as so:</li>\\n\"+\n",
       "     \"</ul>\\n\"+\n",
       "     \"<code>\\n\"+\n",
       "     \"from bokeh.resources import INLINE\\n\"+\n",
       "     \"output_notebook(resources=INLINE)\\n\"+\n",
       "     \"</code>\\n\"+\n",
       "     \"</div>\"}};\n",
       "\n",
       "  function display_loaded() {\n",
       "    if (root.Bokeh !== undefined) {\n",
       "      var el = document.getElementById(\"ad233165-e7b0-4b18-947b-254517c47790\");\n",
       "      if (el != null) {\n",
       "        el.textContent = \"BokehJS \" + Bokeh.version + \" successfully loaded.\";\n",
       "      }\n",
       "    } else if (Date.now() < root._bokeh_timeout) {\n",
       "      setTimeout(display_loaded, 100)\n",
       "    }\n",
       "  }\n",
       "\n",
       "\n",
       "  function run_callbacks() {\n",
       "    try {\n",
       "      root._bokeh_onload_callbacks.forEach(function(callback) { callback() });\n",
       "    }\n",
       "    finally {\n",
       "      delete root._bokeh_onload_callbacks\n",
       "    }\n",
       "    console.info(\"Bokeh: all callbacks have finished\");\n",
       "  }\n",
       "\n",
       "  function load_libs(js_urls, callback) {\n",
       "    root._bokeh_onload_callbacks.push(callback);\n",
       "    if (root._bokeh_is_loading > 0) {\n",
       "      console.log(\"Bokeh: BokehJS is being loaded, scheduling callback at\", now());\n",
       "      return null;\n",
       "    }\n",
       "    if (js_urls == null || js_urls.length === 0) {\n",
       "      run_callbacks();\n",
       "      return null;\n",
       "    }\n",
       "    console.log(\"Bokeh: BokehJS not loaded, scheduling load and callback at\", now());\n",
       "    root._bokeh_is_loading = js_urls.length;\n",
       "    for (var i = 0; i < js_urls.length; i++) {\n",
       "      var url = js_urls[i];\n",
       "      var s = document.createElement('script');\n",
       "      s.src = url;\n",
       "      s.async = false;\n",
       "      s.onreadystatechange = s.onload = function() {\n",
       "        root._bokeh_is_loading--;\n",
       "        if (root._bokeh_is_loading === 0) {\n",
       "          console.log(\"Bokeh: all BokehJS libraries loaded\");\n",
       "          run_callbacks()\n",
       "        }\n",
       "      };\n",
       "      s.onerror = function() {\n",
       "        console.warn(\"failed to load library \" + url);\n",
       "      };\n",
       "      console.log(\"Bokeh: injecting script tag for BokehJS library: \", url);\n",
       "      document.getElementsByTagName(\"head\")[0].appendChild(s);\n",
       "    }\n",
       "  };var element = document.getElementById(\"ad233165-e7b0-4b18-947b-254517c47790\");\n",
       "  if (element == null) {\n",
       "    console.log(\"Bokeh: ERROR: autoload.js configured with elementid 'ad233165-e7b0-4b18-947b-254517c47790' but no matching script tag was found. \")\n",
       "    return false;\n",
       "  }\n",
       "\n",
       "  var js_urls = [\"https://cdn.pydata.org/bokeh/release/bokeh-0.12.7.min.js\", \"https://cdn.pydata.org/bokeh/release/bokeh-widgets-0.12.7.min.js\", \"https://cdn.pydata.org/bokeh/release/bokeh-tables-0.12.7.min.js\", \"https://cdn.pydata.org/bokeh/release/bokeh-gl-0.12.7.min.js\"];\n",
       "\n",
       "  var inline_js = [\n",
       "    function(Bokeh) {\n",
       "      Bokeh.set_log_level(\"info\");\n",
       "    },\n",
       "    \n",
       "    function(Bokeh) {\n",
       "      \n",
       "    },\n",
       "    \n",
       "    function(Bokeh) {\n",
       "      \n",
       "      document.getElementById(\"ad233165-e7b0-4b18-947b-254517c47790\").textContent = \"BokehJS is loading...\";\n",
       "    },\n",
       "    function(Bokeh) {\n",
       "      console.log(\"Bokeh: injecting CSS: https://cdn.pydata.org/bokeh/release/bokeh-0.12.7.min.css\");\n",
       "      Bokeh.embed.inject_css(\"https://cdn.pydata.org/bokeh/release/bokeh-0.12.7.min.css\");\n",
       "      console.log(\"Bokeh: injecting CSS: https://cdn.pydata.org/bokeh/release/bokeh-widgets-0.12.7.min.css\");\n",
       "      Bokeh.embed.inject_css(\"https://cdn.pydata.org/bokeh/release/bokeh-widgets-0.12.7.min.css\");\n",
       "      console.log(\"Bokeh: injecting CSS: https://cdn.pydata.org/bokeh/release/bokeh-tables-0.12.7.min.css\");\n",
       "      Bokeh.embed.inject_css(\"https://cdn.pydata.org/bokeh/release/bokeh-tables-0.12.7.min.css\");\n",
       "    }\n",
       "  ];\n",
       "\n",
       "  function run_inline_js() {\n",
       "    \n",
       "    if ((root.Bokeh !== undefined) || (force === true)) {\n",
       "      for (var i = 0; i < inline_js.length; i++) {\n",
       "        inline_js[i].call(root, root.Bokeh);\n",
       "      }if (force === true) {\n",
       "        display_loaded();\n",
       "      }} else if (Date.now() < root._bokeh_timeout) {\n",
       "      setTimeout(run_inline_js, 100);\n",
       "    } else if (!root._bokeh_failed_load) {\n",
       "      console.log(\"Bokeh: BokehJS failed to load within specified timeout.\");\n",
       "      root._bokeh_failed_load = true;\n",
       "    } else if (force !== true) {\n",
       "      var cell = $(document.getElementById(\"ad233165-e7b0-4b18-947b-254517c47790\")).parents('.cell').data().cell;\n",
       "      cell.output_area.append_execute_result(NB_LOAD_WARNING)\n",
       "    }\n",
       "\n",
       "  }\n",
       "\n",
       "  if (root._bokeh_is_loading === 0) {\n",
       "    console.log(\"Bokeh: BokehJS loaded, going straight to plotting\");\n",
       "    run_inline_js();\n",
       "  } else {\n",
       "    load_libs(js_urls, function() {\n",
       "      console.log(\"Bokeh: BokehJS plotting callback run at\", now());\n",
       "      run_inline_js();\n",
       "    });\n",
       "  }\n",
       "}(window));"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/html": [
       "\n",
       "\n",
       "    <div class=\"bk-root\">\n",
       "        <div class=\"bk-plotdiv\" id=\"aceab6c5-5d71-42c1-b984-cc94de239825\"></div>\n",
       "    </div>\n",
       "<script type=\"text/javascript\">\n",
       "  \n",
       "  (function(root) {\n",
       "    function now() {\n",
       "      return new Date();\n",
       "    }\n",
       "  \n",
       "    var force = false;\n",
       "  \n",
       "    if (typeof (root._bokeh_onload_callbacks) === \"undefined\" || force === true) {\n",
       "      root._bokeh_onload_callbacks = [];\n",
       "      root._bokeh_is_loading = undefined;\n",
       "    }\n",
       "  \n",
       "  \n",
       "    \n",
       "    if (typeof (root._bokeh_timeout) === \"undefined\" || force === true) {\n",
       "      root._bokeh_timeout = Date.now() + 0;\n",
       "      root._bokeh_failed_load = false;\n",
       "    }\n",
       "  \n",
       "    var NB_LOAD_WARNING = {'data': {'text/html':\n",
       "       \"<div style='background-color: #fdd'>\\n\"+\n",
       "       \"<p>\\n\"+\n",
       "       \"BokehJS does not appear to have successfully loaded. If loading BokehJS from CDN, this \\n\"+\n",
       "       \"may be due to a slow or bad network connection. Possible fixes:\\n\"+\n",
       "       \"</p>\\n\"+\n",
       "       \"<ul>\\n\"+\n",
       "       \"<li>re-rerun `output_notebook()` to attempt to load from CDN again, or</li>\\n\"+\n",
       "       \"<li>use INLINE resources instead, as so:</li>\\n\"+\n",
       "       \"</ul>\\n\"+\n",
       "       \"<code>\\n\"+\n",
       "       \"from bokeh.resources import INLINE\\n\"+\n",
       "       \"output_notebook(resources=INLINE)\\n\"+\n",
       "       \"</code>\\n\"+\n",
       "       \"</div>\"}};\n",
       "  \n",
       "    function display_loaded() {\n",
       "      if (root.Bokeh !== undefined) {\n",
       "        var el = document.getElementById(\"aceab6c5-5d71-42c1-b984-cc94de239825\");\n",
       "        if (el != null) {\n",
       "          el.textContent = \"BokehJS \" + Bokeh.version + \" successfully loaded.\";\n",
       "        }\n",
       "      } else if (Date.now() < root._bokeh_timeout) {\n",
       "        setTimeout(display_loaded, 100)\n",
       "      }\n",
       "    }\n",
       "  \n",
       "  \n",
       "    function run_callbacks() {\n",
       "      try {\n",
       "        root._bokeh_onload_callbacks.forEach(function(callback) { callback() });\n",
       "      }\n",
       "      finally {\n",
       "        delete root._bokeh_onload_callbacks\n",
       "      }\n",
       "      console.info(\"Bokeh: all callbacks have finished\");\n",
       "    }\n",
       "  \n",
       "    function load_libs(js_urls, callback) {\n",
       "      root._bokeh_onload_callbacks.push(callback);\n",
       "      if (root._bokeh_is_loading > 0) {\n",
       "        console.log(\"Bokeh: BokehJS is being loaded, scheduling callback at\", now());\n",
       "        return null;\n",
       "      }\n",
       "      if (js_urls == null || js_urls.length === 0) {\n",
       "        run_callbacks();\n",
       "        return null;\n",
       "      }\n",
       "      console.log(\"Bokeh: BokehJS not loaded, scheduling load and callback at\", now());\n",
       "      root._bokeh_is_loading = js_urls.length;\n",
       "      for (var i = 0; i < js_urls.length; i++) {\n",
       "        var url = js_urls[i];\n",
       "        var s = document.createElement('script');\n",
       "        s.src = url;\n",
       "        s.async = false;\n",
       "        s.onreadystatechange = s.onload = function() {\n",
       "          root._bokeh_is_loading--;\n",
       "          if (root._bokeh_is_loading === 0) {\n",
       "            console.log(\"Bokeh: all BokehJS libraries loaded\");\n",
       "            run_callbacks()\n",
       "          }\n",
       "        };\n",
       "        s.onerror = function() {\n",
       "          console.warn(\"failed to load library \" + url);\n",
       "        };\n",
       "        console.log(\"Bokeh: injecting script tag for BokehJS library: \", url);\n",
       "        document.getElementsByTagName(\"head\")[0].appendChild(s);\n",
       "      }\n",
       "    };var element = document.getElementById(\"aceab6c5-5d71-42c1-b984-cc94de239825\");\n",
       "    if (element == null) {\n",
       "      console.log(\"Bokeh: ERROR: autoload.js configured with elementid 'aceab6c5-5d71-42c1-b984-cc94de239825' but no matching script tag was found. \")\n",
       "      return false;\n",
       "    }\n",
       "  \n",
       "    var js_urls = [];\n",
       "  \n",
       "    var inline_js = [\n",
       "      function(Bokeh) {\n",
       "        (function() {\n",
       "          var fn = function() {\n",
       "            var docs_json = {\"9702d5ba-9b62-4ab2-9ec8-8d5a0c352c71\":{\"roots\":{\"references\":[{\"attributes\":{\"callback\":null},\"id\":\"3cef659e-6afa-4941-abde-6fcc01878328\",\"type\":\"DataRange1d\"},{\"attributes\":{},\"id\":\"5e2b8d66-d2f8-441f-be0e-3d9ed4ceafa5\",\"type\":\"BasicTickFormatter\"},{\"attributes\":{\"fill_alpha\":{\"value\":0.6},\"fill_color\":{\"value\":\"orange\"},\"inner_radius\":{\"units\":\"data\",\"value\":0.1},\"line_alpha\":{\"value\":0.6},\"line_color\":{\"value\":\"orange\"},\"outer_radius\":{\"units\":\"data\",\"value\":0.25},\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"00203d92-2691-4889-9e14-ab221ecba896\",\"type\":\"Annulus\"},{\"attributes\":{\"callback\":null,\"column_names\":[\"x\",\"y\"],\"data\":{\"x\":[1,2,3],\"y\":[1,2,3]}},\"id\":\"192d0262-5e81-4bcd-852b-06196bd61eca\",\"type\":\"ColumnDataSource\"},{\"attributes\":{\"overlay\":{\"id\":\"501d103b-7be1-4b68-9984-77ea25d968a0\",\"type\":\"BoxAnnotation\"}},\"id\":\"e99590b9-8e8e-4947-935d-9ef1c4b6c1ce\",\"type\":\"BoxZoomTool\"},{\"attributes\":{},\"id\":\"d075534b-ff13-4023-96e4-35b00c5e18e1\",\"type\":\"PanTool\"},{\"attributes\":{\"below\":[{\"id\":\"69bc5179-fcdf-473b-a3c7-718866966e3c\",\"type\":\"LinearAxis\"}],\"left\":[{\"id\":\"41bd9974-66e3-4a04-a372-6048d784c35a\",\"type\":\"LinearAxis\"}],\"plot_height\":400,\"plot_width\":400,\"renderers\":[{\"id\":\"69bc5179-fcdf-473b-a3c7-718866966e3c\",\"type\":\"LinearAxis\"},{\"id\":\"8c5e98d9-cb90-4a7f-8bb5-192526f2f55d\",\"type\":\"Grid\"},{\"id\":\"41bd9974-66e3-4a04-a372-6048d784c35a\",\"type\":\"LinearAxis\"},{\"id\":\"284129cf-2ea5-4813-8bc9-fd9573e4984b\",\"type\":\"Grid\"},{\"id\":\"501d103b-7be1-4b68-9984-77ea25d968a0\",\"type\":\"BoxAnnotation\"},{\"id\":\"ad6e7fe2-c32a-47ed-a299-d08bbecf0f47\",\"type\":\"GlyphRenderer\"}],\"title\":{\"id\":\"3f839881-22cb-400b-bdcb-8b1a0cbfe857\",\"type\":\"Title\"},\"toolbar\":{\"id\":\"5ae42754-99f7-4395-88a9-085e25658186\",\"type\":\"Toolbar\"},\"x_range\":{\"id\":\"09135b18-cdc7-4e85-a9c8-4bcb78340939\",\"type\":\"DataRange1d\"},\"x_scale\":{\"id\":\"45611527-65bf-4cec-96ec-111db3e95164\",\"type\":\"LinearScale\"},\"y_range\":{\"id\":\"3cef659e-6afa-4941-abde-6fcc01878328\",\"type\":\"DataRange1d\"},\"y_scale\":{\"id\":\"f54cb925-bf8a-40ee-9d75-69627bfe7cbd\",\"type\":\"LinearScale\"}},\"id\":\"acbb00f5-f314-4373-994e-29dd9decc2b5\",\"subtype\":\"Figure\",\"type\":\"Plot\"},{\"attributes\":{},\"id\":\"3fd8b284-a90b-4fb9-8fb6-7f5dffa7b94b\",\"type\":\"BasicTickFormatter\"},{\"attributes\":{},\"id\":\"45611527-65bf-4cec-96ec-111db3e95164\",\"type\":\"LinearScale\"},{\"attributes\":{},\"id\":\"7f46a5b4-da0b-47e2-88b1-e0d38f272619\",\"type\":\"ResetTool\"},{\"attributes\":{\"bottom_units\":\"screen\",\"fill_alpha\":{\"value\":0.5},\"fill_color\":{\"value\":\"lightgrey\"},\"left_units\":\"screen\",\"level\":\"overlay\",\"line_alpha\":{\"value\":1.0},\"line_color\":{\"value\":\"black\"},\"line_dash\":[4,4],\"line_width\":{\"value\":2},\"plot\":null,\"render_mode\":\"css\",\"right_units\":\"screen\",\"top_units\":\"screen\"},\"id\":\"501d103b-7be1-4b68-9984-77ea25d968a0\",\"type\":\"BoxAnnotation\"},{\"attributes\":{\"plot\":{\"id\":\"acbb00f5-f314-4373-994e-29dd9decc2b5\",\"subtype\":\"Figure\",\"type\":\"Plot\"},\"ticker\":{\"id\":\"d7b8821e-b93b-4bd1-a4cd-46b00ab26404\",\"type\":\"BasicTicker\"}},\"id\":\"8c5e98d9-cb90-4a7f-8bb5-192526f2f55d\",\"type\":\"Grid\"},{\"attributes\":{\"active_drag\":\"auto\",\"active_inspect\":\"auto\",\"active_scroll\":\"auto\",\"active_tap\":\"auto\",\"tools\":[{\"id\":\"d075534b-ff13-4023-96e4-35b00c5e18e1\",\"type\":\"PanTool\"},{\"id\":\"229155f1-9211-4c41-a0d6-62d823218ed1\",\"type\":\"WheelZoomTool\"},{\"id\":\"e99590b9-8e8e-4947-935d-9ef1c4b6c1ce\",\"type\":\"BoxZoomTool\"},{\"id\":\"a30ef6d3-971f-4549-9b6b-8415e2d0321c\",\"type\":\"SaveTool\"},{\"id\":\"7f46a5b4-da0b-47e2-88b1-e0d38f272619\",\"type\":\"ResetTool\"},{\"id\":\"28517a32-2c6d-4d5d-a56c-96ce04a93589\",\"type\":\"HelpTool\"}]},\"id\":\"5ae42754-99f7-4395-88a9-085e25658186\",\"type\":\"Toolbar\"},{\"attributes\":{},\"id\":\"f54cb925-bf8a-40ee-9d75-69627bfe7cbd\",\"type\":\"LinearScale\"},{\"attributes\":{\"formatter\":{\"id\":\"3fd8b284-a90b-4fb9-8fb6-7f5dffa7b94b\",\"type\":\"BasicTickFormatter\"},\"plot\":{\"id\":\"acbb00f5-f314-4373-994e-29dd9decc2b5\",\"subtype\":\"Figure\",\"type\":\"Plot\"},\"ticker\":{\"id\":\"d7b8821e-b93b-4bd1-a4cd-46b00ab26404\",\"type\":\"BasicTicker\"}},\"id\":\"69bc5179-fcdf-473b-a3c7-718866966e3c\",\"type\":\"LinearAxis\"},{\"attributes\":{\"plot\":null,\"text\":\"\"},\"id\":\"3f839881-22cb-400b-bdcb-8b1a0cbfe857\",\"type\":\"Title\"},{\"attributes\":{\"data_source\":{\"id\":\"192d0262-5e81-4bcd-852b-06196bd61eca\",\"type\":\"ColumnDataSource\"},\"glyph\":{\"id\":\"00203d92-2691-4889-9e14-ab221ecba896\",\"type\":\"Annulus\"},\"hover_glyph\":null,\"muted_glyph\":null,\"nonselection_glyph\":{\"id\":\"57c1024e-2370-45a6-8fdc-1689dbed31c8\",\"type\":\"Annulus\"},\"selection_glyph\":null,\"view\":{\"id\":\"d1376c44-e0c0-45f9-be11-b00122773ac8\",\"type\":\"CDSView\"}},\"id\":\"ad6e7fe2-c32a-47ed-a299-d08bbecf0f47\",\"type\":\"GlyphRenderer\"},{\"attributes\":{},\"id\":\"a30ef6d3-971f-4549-9b6b-8415e2d0321c\",\"type\":\"SaveTool\"},{\"attributes\":{\"callback\":null},\"id\":\"09135b18-cdc7-4e85-a9c8-4bcb78340939\",\"type\":\"DataRange1d\"},{\"attributes\":{\"fill_alpha\":{\"value\":0.1},\"fill_color\":{\"value\":\"#1f77b4\"},\"inner_radius\":{\"units\":\"data\",\"value\":0.1},\"line_alpha\":{\"value\":0.1},\"line_color\":{\"value\":\"#1f77b4\"},\"outer_radius\":{\"units\":\"data\",\"value\":0.25},\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"57c1024e-2370-45a6-8fdc-1689dbed31c8\",\"type\":\"Annulus\"},{\"attributes\":{\"dimension\":1,\"plot\":{\"id\":\"acbb00f5-f314-4373-994e-29dd9decc2b5\",\"subtype\":\"Figure\",\"type\":\"Plot\"},\"ticker\":{\"id\":\"7e6ccbbe-d38c-45ae-9803-1fef325fa016\",\"type\":\"BasicTicker\"}},\"id\":\"284129cf-2ea5-4813-8bc9-fd9573e4984b\",\"type\":\"Grid\"},{\"attributes\":{},\"id\":\"7e6ccbbe-d38c-45ae-9803-1fef325fa016\",\"type\":\"BasicTicker\"},{\"attributes\":{},\"id\":\"d7b8821e-b93b-4bd1-a4cd-46b00ab26404\",\"type\":\"BasicTicker\"},{\"attributes\":{\"source\":{\"id\":\"192d0262-5e81-4bcd-852b-06196bd61eca\",\"type\":\"ColumnDataSource\"}},\"id\":\"d1376c44-e0c0-45f9-be11-b00122773ac8\",\"type\":\"CDSView\"},{\"attributes\":{},\"id\":\"229155f1-9211-4c41-a0d6-62d823218ed1\",\"type\":\"WheelZoomTool\"},{\"attributes\":{},\"id\":\"28517a32-2c6d-4d5d-a56c-96ce04a93589\",\"type\":\"HelpTool\"},{\"attributes\":{\"formatter\":{\"id\":\"5e2b8d66-d2f8-441f-be0e-3d9ed4ceafa5\",\"type\":\"BasicTickFormatter\"},\"plot\":{\"id\":\"acbb00f5-f314-4373-994e-29dd9decc2b5\",\"subtype\":\"Figure\",\"type\":\"Plot\"},\"ticker\":{\"id\":\"7e6ccbbe-d38c-45ae-9803-1fef325fa016\",\"type\":\"BasicTicker\"}},\"id\":\"41bd9974-66e3-4a04-a372-6048d784c35a\",\"type\":\"LinearAxis\"}],\"root_ids\":[\"acbb00f5-f314-4373-994e-29dd9decc2b5\"]},\"title\":\"Bokeh Application\",\"version\":\"0.12.7\"}};\n",
       "            var render_items = [{\"docid\":\"9702d5ba-9b62-4ab2-9ec8-8d5a0c352c71\",\"elementid\":\"aceab6c5-5d71-42c1-b984-cc94de239825\",\"modelid\":\"acbb00f5-f314-4373-994e-29dd9decc2b5\"}];\n",
       "            \n",
       "            Bokeh.embed.embed_items(docs_json, render_items);\n",
       "          };\n",
       "          if (document.readyState != \"loading\") fn();\n",
       "          else document.addEventListener(\"DOMContentLoaded\", fn);\n",
       "        })();\n",
       "      },\n",
       "      function(Bokeh) {\n",
       "      }\n",
       "    ];\n",
       "  \n",
       "    function run_inline_js() {\n",
       "      \n",
       "      if ((root.Bokeh !== undefined) || (force === true)) {\n",
       "        for (var i = 0; i < inline_js.length; i++) {\n",
       "          inline_js[i].call(root, root.Bokeh);\n",
       "        }if (force === true) {\n",
       "          display_loaded();\n",
       "        }} else if (Date.now() < root._bokeh_timeout) {\n",
       "        setTimeout(run_inline_js, 100);\n",
       "      } else if (!root._bokeh_failed_load) {\n",
       "        console.log(\"Bokeh: BokehJS failed to load within specified timeout.\");\n",
       "        root._bokeh_failed_load = true;\n",
       "      } else if (force !== true) {\n",
       "        var cell = $(document.getElementById(\"aceab6c5-5d71-42c1-b984-cc94de239825\")).parents('.cell').data().cell;\n",
       "        cell.output_area.append_execute_result(NB_LOAD_WARNING)\n",
       "      }\n",
       "  \n",
       "    }\n",
       "  \n",
       "    if (root._bokeh_is_loading === 0) {\n",
       "      console.log(\"Bokeh: BokehJS loaded, going straight to plotting\");\n",
       "      run_inline_js();\n",
       "    } else {\n",
       "      load_libs(js_urls, function() {\n",
       "        console.log(\"Bokeh: BokehJS plotting callback run at\", now());\n",
       "        run_inline_js();\n",
       "      });\n",
       "    }\n",
       "  }(window));\n",
       "</script>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "from bokeh.plotting import figure, show,output_notebook\n",
    "output_notebook()\n",
    "p = figure(plot_width=400, plot_height=400)\n",
    "p.annulus(x=[1, 2, 3], y=[1, 2, 3], inner_radius=0.1, outer_radius=0.25,\n",
    "          color=\"orange\", alpha=0.6)\n",
    "show(p)"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.6.2"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
